#include #include #include using namespace atcoder; using mint = modint1000000007; using namespace std; #define rep(i,n) for(int i=0;i<(n);i++) #define Inf 1000000001 template struct matrix{ vector> v; int _h,_w; matrix(vector> X){ v = X; _h = X.size(); _w = 0; if(X.size()>0)_w = X[0].size(); } matrix(int h,int w){ v.resize(h,vector(w,e0())); _h = h; _w = w; } void add_element(int from,int to,S x){ v[to][from] = op0(v[to][from],x); } matrix e(){ assert(_h==_w); matrix ret(_h,_w); for(int i=0;i<_h;i++){ for(int j=0;j<_w;j++){ if(i==j)ret.v[i][j] = e1(); else ret.v[i][j] = e0(); } } return ret; } matrix &operator*=(const matrix &another){ matrix ret(_h,another._w); for(int i=0;i<_h;i++){ for(int j=0;j ret = e(); auto temp = *this; while(cnt!=0LL){ if((cnt&1)==1){ ret *= temp; } temp *= temp; cnt>>=1; } return ret; } }; mint op0(mint a,mint b){ return a+b; } mint e0(){ return 0; } mint op1(mint a,mint b){ return a*b; } mint e1(){ return 1; } int main(){ long long L,N,m; cin>>L>>N>>m; vector K(m); rep(i,m)cin>>K[i]; map ,int> mp; int t= 0; rep(i,m){ for(int j=1;j<=K[i]+1;j++){ mp[make_pair(K[i],j)] = t; t++; } } //cout<<'a'< M(t,t); //cout<<'a'< temp(t,1); temp.v[start][0] = 1; temp = M * temp; mint ans = 0; rep(i,m){ ans += temp.v[mp[make_pair(K[i],K[i])]][0]; } ans += temp.v[goal][0]; cout<