#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <string>
#include <cmath>
#include <bitset>
#include <complex>
#include <functional>
#include <ctime>
#include <cassert>
#include <fstream>
#include <stack>
#include <random>
#include <iomanip>

#include <fstream>


using namespace std;
typedef long long ll;
typedef long double dd;
#define i_7 (ll)(1E9+7)
//#define i_7 998244353
#define i_5 i_7-2
ll mod(ll a){
    ll c=a%i_7;
    if(c>=0)return c;
    return c+i_7;
}
typedef pair<ll,ll> l_l;
ll inf=(ll)1E18;
#define rep(i,l,r) for(ll i=l;i<=r;i++)
#define pb push_back
ll max(ll a,ll b){if(a<b)return b;else return a;}
ll min(ll a,ll b){if(a>b)return b;else return a;}
dd EPS=1E-9;
#define endl "\n"
#define fastio ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);





// セグ木

ll segnodenum;
vector<ll> segnode;

ll init_num=0;
ll func(ll x,ll y){
    return x+y;
}

void init(vector<ll> v){
    segnodenum=1;
    while(v.size()>segnodenum)segnodenum*=2;
    segnode.resize(2*segnodenum-1,init_num);
    rep(i,segnodenum-1,segnodenum*2-2){
        if(i-(segnodenum-1)<v.size()){
            segnode[i]=v[i-(segnodenum-1)];
        }else{
            segnode[i]=init_num;
        }
    }
    for(ll i=segnodenum-2;i>=0;i--){
        segnode[i]=func(segnode[2*i+1],segnode[2*i+2]);
    }
}

void update(ll x,ll y){ //v[x]をyに変更する
    segnode[x+segnodenum-1]=y;
    ll next=x+segnodenum-1;
    while(next>0){
        next=(next-1)/2;
        segnode[next]=func(segnode[2*next+1],segnode[2*next+2]);
    }
}

ll find(ll i,ll j,ll x,ll y,ll z){     //v[[i,j)]でのfuncの結果を出力する //segnode[x]に着目しているsegnode[x]が担当する範囲は[y,z); //最初はx=-1で
    if(x==-1) return find(i,j,0,0,segnodenum);
    if(j<=y || z<=i)return init_num;
    if(i<=y && z<=j)return segnode[x];
    return func(find(i,j,2*x+1,y,(y+z)/2),find(i,j,2*x+2,(y+z)/2,z));
}


int main(){fastio
    ll n,x;cin>>n>>x;
    vector<ll> v;
    rep(i,0,n-1){
        ll a;cin>>a;
        if(a!=x){
            v.pb(a);
        }
    }
    rep(i,0,(ll)v.size()-1){
        if(i==0){
            cout<<v[i];
        }else{
            cout<<" "<<v[i];
        }
    }
    cout<<endl;
    
    return 0;
    
}






#include <cstdio>
#include <cctype>
#define rr register
using namespace std;
const int N=100011,mod=1000000007;
int dp[N][2],f[N][2],n;
inline signed iut(){
	rr int ans=0; rr char c=getchar();
	while (!isdigit(c)) c=getchar();
	while (isdigit(c)) ans=(ans<<3)+(ans<<1)+(c^48),c=getchar();
	return ans;
}
inline void print(int ans){
	if (ans>9) print(ans/10);
	putchar(ans%10+48);
}
inline signed mo(int x,int y){return x+y>=mod?x+y-mod:x+y;}
signed main(){
	n=iut();
	for (rr int i=1;i<=n;++i){
		rr int x=iut();
		if (i==1) dp[i][1]=x,f[i][1]=1;
		else{
			f[i][0]=f[i-1][1],dp[i][0]=mo(dp[i-1][1],mod-1ll*f[i][0]*x%mod);
			f[i][1]=mo(f[i-1][0],f[i-1][1]),dp[i][1]=mo(mo(dp[i-1][0],dp[i-1][1]),1ll*f[i][1]*x%mod);
		}
	}
	return !printf("%d",mo(dp[n][0],dp[n][1]));
}