#include <bits/stdc++.h>
#include <algorithm>
using namespace std;
#define ll          long long
#define ld          long double
#define fi          first
#define se          second
#define mp          make_pair
#define pb          push_back
#define eb          emplace_back
#define pii         pair<int,int>
#define ppll        pair < pll , pll >
#define sd(x)       scanf("%d",&x)
#define sld(x)      scanf("%lld",&x)
#define INF         1e18
#define eps         0.00001
#define le          length
#define pqb         priority_queue<int>//MIN HEAP
#define pqs         priority_queue<int,vi,greater<int> > //MAX HEAP


#define debug(n1)   cout << n1 << endl
#define rep(i , j , n)          for(ll i = j ; i <= n ; i++)
#define per(i , j , n)          for(ll i = j ; i >= n ; i--)
const ll N = 3e5 + 5;
const ll MAX = 3e5 + 5;
const ll M = 1e6 + 5;
const ll Z = 1000000007;
//const int mod = 1e18 + 7;


ll MODULAR_POWER(ll a , ll b , ll MOD) {
    if(b == 0) return 1LL;
    ll d = MODULAR_POWER(a , b / 2 , MOD);
    d *= d;
    d %= MOD;
    if(b % 2) d *= a;
    d %= MOD;
    return d;
}


ll BINARY_SEARCH(ll dp[] , ll n , ll key) {
    ll s = 1;
    ll e = n;
    while(s <= e) {
        ll mid = (s + e) / 2;
        if(dp[mid] == key) return mid;
        else if (dp[mid] > key) e = mid - 1;
        else s = mid + 1;
    }
    return -1;
}


int gcd(int m,int n)
{
    return __gcd(m,n);
}
string CONVERT_TO_BINARY(ll s) {
    string res = "";
    while(s != 0) {
        res += (char)('0' + s % 2);
        s /= 2;
    }
    reverse(res.begin() , res.end());
    return res;
}


bool PALIN(string s) {
    ll i = 0;
    ll j = s.le() - 1;
    while(i <= j) {
        if(s[i] != s[j]) return false;
        j-- , i++;
    }
    return true;
}

ll STOI(string s) {
    ll num = 0;
    ll po = 1;
    per(i , s.le() - 1 , 0) {
        num += po * (s[i] - '0');
        po *= 10;
    }
    return num;
}
void solve()
{
    int n,x;
    cin >> n >> x;

    vector<int> v;
    for(int i=0;i<n;i++)
    {
        int a;
        cin >> a;

        if(a != x)
            v.push_back(a);
    }
    for(auto x : v)
        cout << x << " ";

  
}

int main() {

    cout.precision(8);
    cout << fixed;
    
       solve();




    return 0;
}
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

const int mod = 1e9+7;
const int N = 3005;

int add(int a, int b) {
    return a + b < mod ? a + b : a + b - mod;
}
int dp[N][N];
ll ps[N], a[N];
vector<int> occ[N][N];
int n;

int f(int i, int j) {
    if(i == n) return 1;
    int &ans = dp[i][j];
    if(~ans) return ans;
    ans = 0;

    int tar = i == 0 ? 0 : int(ps[i - 1] % j);

    const vector<int> &vec = occ[j][tar];

    auto it = lower_bound(vec.begin(), vec.end(), i);

    if(it == vec.end()) return ans = 0;

    int pos = *it;

    ans = add(ans, f(pos + 1, j));
    if(pos + 1 < n) ans = add(ans, f(pos + 1, j + 1));

    return ans;
}

int main() {
    memset(dp, -1, sizeof dp);
    scanf("%d", &n);

    for(int i = 0; i < n; i++) scanf("%lld", a + i);

    partial_sum(a, a + n, ps);

    for(int j = 1; j <= n; j++) {
        for(int i = 0; i < n; i++) {
            occ[j][ ps[i] % j ].push_back(i);
        }
    }


    printf("%d\n", f(0, 1));
}
