Problem:
Max Score: 1000 Points

Problem Statement

There is a railroad company in Atcoder Kingdom, "Atcoder Railroad".

There are N + 1 stations numbered 0, 1, 2, ..., N along a railway.

Currently, two kinds of train are operated, local and express.

A local train stops at every station, and it takes one minute from station i to i + 1, and vice versa.

An express train only stops at station S_0, S_1, S_2, ..., S_{K-1} (0 = S_0 < S_1 < S_2 < ... < S_{K-1} = N). It takes one minute from station S_i to S_{i + 1}, and vice versa.

But the president of Atcoder Railroad, Semiexp said it is not very convenient so he planned to operate one more kind of train, "semi-express".

The stations where the semi-express stops (This is T_0, T_1, T_2, ..., T_{L-1}, 0 = T_0 < T_1 < T_2 < ... < T_{L-1} = N) have to follow following conditions:

From station T_i to T_{i+1} takes 1 minutes, and vice versa.

The center of Atcoder Kingdom is station 0, and you have to be able to go to station i atmost X minutes.

If the express stops at the station, semi-express should stops at the station.

Print the number of ways of the set of the station where semi-express stops (sequence T).

Since the answer can be large, print the number modulo 10^9 + 7.

Input Format

N K X
S_0 S_1 S_2 ... S_{K-1}

Output Format

Print the number of ways of the set of the station where semi-express stops, mod 10^9 + 7 in one line.

Print \n (line break) in the end.

Constraints

2 ≤ K ≤ 2500.

1 ≤ X ≤ 2500.

S_0 = 0, S_{K-1} = N.

1 ≤ S_{i + 1} - S_i ≤ 10000.

Scoring

Subtask 1 [120 points]

N, K, X ≤ 15.

Subtask 2 [90 points]

K, X ≤ 15.

S_{i + 1} - S_i ≤ 15.

Subtask 3 [260 points]

K, X ≤ 40.

S_{i + 1} - S_i ≤ 40.

Subtask 4 [160 points]

K, X ≤ 300.

S_{i + 1} - S_i ≤ 300.

Subtask 5 [370 points]

There are no additional constraints.

Sample Input 1

7 2 3
0 7

Sample Output 1

55

The set of trains that stops station 0 and 7, and can't satisfy the condition is:

[0, 7], [0, 1, 7], [0, 1, 2, 7], [0, 1, 6, 7], [0, 1, 2, 6, 7], [0, 1, 2, 3, 6, 7], [0, 1, 2, 5, 6, 7], [0, 1, 2, 3, 5, 6, 7], [0, 1, 2, 3, 4, 5, 6, 7], 9 ways.

Therefore, the number of ways is 2^6 - 9 = 55.

Solution in C++14 (GCC 5.4.1) (judge verdict: Runtime Error)

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pi M_PI
#define R cin>>
#define Z class
#define ll long long
#define ln cout<<'\n'
#define in(a) insert(a)
#define pb(a) push_back(a)
#define pd(a) printf("%.10f\n",a)
#define mem(a) memset(a,0,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define iter(c) __typeof((c).begin())
#define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--)
#define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++)
#define rep(i,n) REP(i,0,n)
#define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++)
template<Z A>void pr(A a){cout<<a;ln;}
template<Z A,Z B>void pr(A a,B b){cout<<a<<' ';pr(b);}
template<Z A,Z B,Z C>void pr(A a,B b,C c){cout<<a<<' ';pr(b,c);}
template<Z A,Z B,Z C,Z D>void pr(A a,B b,C c,D d){cout<<a<<' ';pr(b,c,d);}
template<Z A>void PR(A a,ll n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;}
ll check(ll n,ll m,ll x,ll y){return x>=0&&x<n&&y>=0&&y<m;}
const ll MAX=1000000007,MAXL=1LL<<61,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1};
typedef pair<int,int> P;

void Main() {
  ll n,m,r;
  cin >> n >> m >> r;
  vector<int> v[n+1];
  int a[m];
  rep(i,m) R a[i];
  rep(i,m-1) {
    v[a[i]].pb(a[i+1]);
    v[a[i+1]].pb(a[i]);
  }
  rep(i,n) {
    v[i].pb(i+1);
    v[i+1].pb(i);
  }
  int ans=0;
  rep(t,1<<(n+1)) {
    if(!(t&(1<<0))||!(t&(1<<n))) continue;
    vector<int> b;
    rep(i,n+1) {
      if(t&(1<<i)) b.pb(i);
    }
    vector<int> g[n+1];
    rep(i,b.size()-1) {
      g[b[i]].pb(b[i+1]);
      g[b[i+1]].pb(b[i]);
    }
    int d[n+1];
    fill(d,d+n+1,MAX);
    d[0]=0;
    queue<int> que;
    que.push(0);
    int f=1;
    while(!que.empty()) {
      int x=que.front();que.pop();
      if(d[x]>r) f=0;
      rep(i,v[x].size()) {
        int y=v[x][i];
        if(d[y]<=d[x]+1) continue;
        d[y]=d[x]+1;
        que.push(y);
      }
      rep(i,g[x].size()) {
        int y=g[x][i];
        if(d[y]<=d[x]+1) continue;
        d[y]=d[x]+1;
        que.push(y);
      }
    }
    ans+=f;
  }
  pr(ans);
}

int main(){ios::sync_with_stdio(0);cin.tie(0);Main();return 0;}