https://www.codechef.com/problems/KFIB and what is wrong with my code?

#include<bits/stdc++.h>
using namespace std;
#define inf 1000000007;
typedef long long ll;
int main()
{
ll n,k,s=0,s2=0;

cin>>n>>k;
ll a[n+1]={0};

for(int i=1;i<=k;i++)
{
	a[i]=1;
	s++;
}

for(int i=k+1;i<=n;i++)
{
	s2=s2+a[i-k-1];
	a[i]=(s-s2)%inf;
	s=s+a[i];
}
cout<<a[n]<<endl;

}