#include<bits/stdc++.h>
#define int long long
#define maxn
#define pb push_back
#define fi first
#define se second
#define fastio ios::sync_with_stdio(); cin.tie(0); cout.tie(0);
using namespace std;

const int mod = 1e9+7;
const int INF = INT_MAX;
const long double pi = 4*atan((long double)1);
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

int dp[2002][2002];

signed main()
{
	fastio;
	int n, m;	cin >> n >> m;
	string str;	cin >> str;
	dp[1][1] = 1;
	dp[0][0] = 1;
	int temp = n-m;
	for (int i = 2; i <= 2000; i++)
	{
		for (int j = 0; j <= 2000; j++)
		{
			if ((i - j) % 2 == 0)
			{
				if (i == j)	dp[i][j] = 1;
				else
				{
					dp[i][j] = dp[i-1][j-1] + dp[i-1][j+1];
				}
				dp[i][j] %= mod;
			}
			else dp[i][j] = 0;
		}
	}
	int sum = 0;
	for (int i = 0; i < str.length(); i++)
	{
		if (str[i] == '(')	sum++;
		else sum--;
	}
	sum = abs(sum);
	int ans = 0;
	for (int i = 0; i <= temp; i++)
	{
		int rest = temp - i;
		for (int j = 0; j <= i; j++)
		{
			int demo = j + sum;
			if (demo > rest)	break;
			ans += dp[i][j] * dp[rest][demo];
			ans %= mod;
		}
	}
	cout << ans;
	return 0;
}


#include<bits/stdc++.h>
#define int long long
#define maxn
#define pb push_back
#define fi first
#define se second
#define fastio ios::sync_with_stdio(); cin.tie(0); cout.tie(0);
using namespace std;

const int mod = 1e9+7;
const int INF = INT_MAX;
const long double pi = 4*atan((long double)1);
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

int dp[2002][2002];

signed main()
{
	fastio;
	int n, m;	cin >> n >> m;
	string str;	cin >> str;
	dp[1][1] = 1;
	dp[0][0] = 1;
	int temp = n-m;
	for (int i = 2; i <= 2000; i++)
	{
		if (i % 2 == 0)	dp[i][0] = dp[i-1][1];
		dp[i][i] = 1;
		for (int j = 1; j <= i-1; j++)
		{
			if ((i - j) % 2 == 0)
			{
				dp[i][j] = dp[i-1][j-1] + dp[i-1][j+1];
				dp[i][j] %= mod;
			}
			else dp[i][j] = 0;
		}
	}
	int sum = 0, l = 0;
	for (int i = 0; i < str.length(); i++)
	{
		if (str[i] == '(')	sum++;
		else sum--;
//		l = min(l, sum);
	}
//	if (l < 0)	l = -l;
	if (sum < 0)	sum = -sum;
	int ans = 0;
	for (int i = 0; i <= temp; i++)
	{
		int rest = temp - i;
		for (int j = 0; j <= i; j++)
		{
			int demo = j + sum;
			if (demo > rest)	break;
			ans += dp[i][j] * dp[rest][demo];
			ans %= mod;
		}
	}
	cout << ans;
	return 0;
}


#include<bits/stdc++.h>
#define int long long
#define maxn
#define pb push_back
#define fi first
#define se second
#define fastio ios::sync_with_stdio(); cin.tie(0); cout.tie(0);
using namespace std;

const int mod = 1e9+7;
const int INF = INT_MAX;
const long double pi = 4*atan((long double)1);
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

int dp[2002][2002];

signed main()
{
	fastio;
	int n, m;	cin >> n >> m;
	string str;	cin >> str;
	dp[1][1] = 1;
	dp[0][0] = 1;
	int temp = n-m;
	for (int i = 2; i <= 2000; i++)
	{
		if (i % 2 == 0)	dp[i][0] = dp[i-1][1];
		dp[i][i] = 1;
		for (int j = 1; j <= i-1; j++)
		{
			if ((i - j) % 2 == 0)
			{
				dp[i][j] = dp[i-1][j-1] + dp[i-1][j+1];
				dp[i][j] %= mod;
			}
			else dp[i][j] = 0;
		}
	}
	int sum = 0, l = 0;
	for (int i = 0; i < str.length(); i++)
	{
		if (str[i] == '(')	sum++;
		else sum--;
		l = min(l, sum);
	}
	if (l < 0)	l = -l;
	int ans = 0;
	for (int i = 0; i <= temp; i++)
	{
		int res = temp - i;
		for (int j = l; j <= i; j++)
		{
			int demo = j + sum;
			if (demo > res)	break;
			ans += dp[i][j] * dp[res][demo];
			ans %= mod;
		}
	}
	cout << ans;
}


#include<bits/stdc++.h>
#define int long long
#define maxn
#define pb push_back
#define fi first
#define se second
#define fastio ios::sync_with_stdio(); cin.tie(0); cout.tie(0);
using namespace std;

const int mod = 1e9+7;
const int INF = INT_MAX;
const long double pi = 4*atan((long double)1);
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

int dp[2002][2002];

signed main()
{
	fastio;
	int n, m;	cin >> n >> m;
	string str;	cin >> str;
	dp[1][1] = 1;
	dp[0][0] = 1;
	int temp = n-m;
	for (int i = 2; i <= 2000; i++)
	{
		if (i % 2 == 0)	dp[i][0] = dp[i-1][1];
		dp[i][i] = 1;
		for (int j = 1; j <= i-1; j++)
		{
			if ((i - j) % 2 == 0)
			{
				dp[i][j] = dp[i-1][j-1] + dp[i-1][j+1];
				dp[i][j] %= mod;
			}
			else dp[i][j] = 0;
		}
	}
	int sum = 0, l = 0;
	for (int i = 0; i < str.length(); i++)
	{
		if (str[i] == '(')	sum++;
		else sum--;
		l = min(l, sum);
	}
	if (l < 0)	l = -l;
	if (sum < 0)	sum = -sum;
	int ans = 0;
	for (int i = 0; i <= temp; i++)
	{
		int res = temp - i;
		for (int j = l; j <= i; j++)
		{
			int demo = j + sum;
			if (demo > res)	break;
			ans += dp[i][j] * dp[res][demo];
			ans %= mod;
		}
	}
	cout << ans;
}


#include<bits/stdc++.h>
#define int long long
#define maxn
#define pb push_back
#define fi first
#define se second
#define fastio ios::sync_with_stdio(); cin.tie(0); cout.tie(0);
using namespace std;

const int mod = 1e9+7;
const int INF = INT_MAX;
const long double pi = 4*atan((long double)1);
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

int dp[2002][2002];

signed main()
{
	fastio;
	int n, m;	cin >> n >> m;
	string str;	cin >> str;
	dp[1][1] = 1;
	dp[0][0] = 1;
	int temp = n-m;
	for (int i = 2; i <= 2000; i++)
	{
		if (i % 2 == 0)	dp[i][0] = dp[i-1][1];
		dp[i][i] = 1;
		for (int j = 1; j <= i-1; j++)
		{
			if ((i - j) % 2 == 0)
			{
				dp[i][j] = dp[i-1][j-1] + dp[i-1][j+1];
				dp[i][j] %= mod;
			}
			else dp[i][j] = 0;
		}
	}
	int sum = 0, l = 0;
	for (int i = 0; i < str.length(); i++)
	{
		if (str[i] == '(')	sum++;
		else sum--;
		l = min(l, sum);
	}
	if (l < 0)	l = -l;
	if (sum < 0)	sum = -sum;
	int ans = 0;
	for (int i = 0; i <= temp; i++)
	{
		int rest = temp - i;
		for (int j = l; j <= i; j++)
		{
			int demo = j + sum;
			if (demo > rest)	break;
			ans += dp[i][j] * dp[rest][demo];
			ans %= mod;
		}
	}
	cout << ans;
	return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;

template <int MOD=1000000007>
struct Modular {
  int value;
  static const int MOD_value = MOD;

  Modular(long long v = 0) { value = v % MOD; if (value < 0) value += MOD;}
  Modular(long long a, long long b) : value(0){ *this += a; *this /= b;}

  Modular& operator+=(Modular const& b) {value += b.value; if (value >= MOD) value -= MOD; return *this;}
  Modular& operator-=(Modular const& b) {value -= b.value; if (value < 0) value += MOD;return *this;}
  Modular& operator*=(Modular const& b) {value = (long long)value * b.value % MOD;return *this;}

  friend Modular mexp(Modular a, long long e) {
    Modular res = 1; while (e) { if (e&1) res *= a; a *= a; e >>= 1; }
    return res;
  }
  friend Modular inverse(Modular a) { return mexp(a, MOD - 2); }

  Modular& operator/=(Modular const& b) { return *this *= inverse(b); }
  friend Modular operator+(Modular a, Modular const b) { return a += b; }
  friend Modular operator-(Modular a, Modular const b) { return a -= b; }
  friend Modular operator-(Modular const a) { return 0 - a; }
  friend Modular operator*(Modular a, Modular const b) { return a *= b; }
  friend Modular operator/(Modular a, Modular const b) { return a /= b; }
  friend std::ostream& operator<<(std::ostream& os, Modular const& a) {return os << a.value;}
  friend bool operator==(Modular const& a, Modular const& b) {return a.value == b.value;}
  friend bool operator!=(Modular const& a, Modular const& b) {return a.value != b.value;}
};

Modular<M> val[2005][2005];
void calc() {
  val[0][0] = 1;
  for (int i = 0; i < 2002; ++i) {
    for (int j = 0; j <= i; ++j) {
      val[i + 1][j + 1] += val[i][j];
      if (j)  val[i + 1][j - 1] += val[i][j];
    }
  }
}

int main() {

  ios::sync_with_stdio(false);
  cout.tie(nullptr);
  cin.tie(nullptr);

  int n, m;
  cin >> n >> m;

  string s;
  cin >> s;

  int p = 0;
  bool valid = 1;

  for (auto c : s) {
    if (c == '(') p++;
    else p--;

    if (p < 0)  valid = 0;
  }

  calc();
  Modular<M> ans;
  int sz = n - m;
  for (int len = 0; len <= sz; ++len) {
    for (int pl = 0; pl <= len; ++pl) {
      int rlen = sz-len, pr = p + pl;
      if (pr > 2000)  continue;
      ans += val[len][pl] * val[rlen][pr];
    }
  }

  if (!valid) ans = 0;
  cout << ans << '\n';
}


#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;

template <int MOD=1000000007>
struct Modular {
  int value;
  static const int MOD_value = MOD;

  Modular(long long v = 0) { value = v % MOD; if (value < 0) value += MOD;}
  Modular(long long a, long long b) : value(0){ *this += a; *this /= b;}

  Modular& operator+=(Modular const& b) {value += b.value; if (value >= MOD) value -= MOD; return *this;}
  Modular& operator-=(Modular const& b) {value -= b.value; if (value < 0) value += MOD;return *this;}
  Modular& operator*=(Modular const& b) {value = (long long)value * b.value % MOD;return *this;}

  friend Modular mexp(Modular a, long long e) {
    Modular res = 1; while (e) { if (e&1) res *= a; a *= a; e >>= 1; }
    return res;
  }
  friend Modular inverse(Modular a) { return mexp(a, MOD - 2); }

  Modular& operator/=(Modular const& b) { return *this *= inverse(b); }
  friend Modular operator+(Modular a, Modular const b) { return a += b; }
  friend Modular operator-(Modular a, Modular const b) { return a -= b; }
  friend Modular operator-(Modular const a) { return 0 - a; }
  friend Modular operator*(Modular a, Modular const b) { return a *= b; }
  friend Modular operator/(Modular a, Modular const b) { return a /= b; }
  friend std::ostream& operator<<(std::ostream& os, Modular const& a) {return os << a.value;}
  friend bool operator==(Modular const& a, Modular const& b) {return a.value == b.value;}
  friend bool operator!=(Modular const& a, Modular const& b) {return a.value != b.value;}
};

Modular<M> val[2005][2005];
void calc() {
  val[0][0] = 1;
  for (int i = 0; i < 2002; ++i) {
    for (int j = 0; j <= i; ++j) {
      val[i + 1][j + 1] += val[i][j];
      if (j)  val[i + 1][j - 1] += val[i][j];
    }
  }
}

int main() {

  ios::sync_with_stdio(false);
  cout.tie(nullptr);
  cin.tie(nullptr);

  int n, m;
  cin >> n >> m;

  string s;
  cin >> s;

  int p = 0, mn = 0;

  for (auto c : s) {
    if (c == '(') p++;
    else p--;

    mn = min(mn, p);
  }

  calc();
  Modular<M> ans;
  int sz = n - m;
  for (int len = 0; len <= sz; ++len) {
    for (int pl = mn; pl <= len; ++pl) {
      int rlen = sz-len, pr = p + pl;
      if (pr > 2000)  continue;
      ans += val[len][pl] * val[rlen][pr];
    }
  }

  cout << ans << '\n';
}


#include <bits/stdc++.h>
using namespace std;
const int M = 1e9 + 7;

template <int MOD=1000000007>
struct Modular {
  int value;
  static const int MOD_value = MOD;

  Modular(long long v = 0) { value = v % MOD; if (value < 0) value += MOD;}
  Modular(long long a, long long b) : value(0){ *this += a; *this /= b;}

  Modular& operator+=(Modular const& b) {value += b.value; if (value >= MOD) value -= MOD; return *this;}
  Modular& operator-=(Modular const& b) {value -= b.value; if (value < 0) value += MOD;return *this;}
  Modular& operator*=(Modular const& b) {value = (long long)value * b.value % MOD;return *this;}

  friend Modular mexp(Modular a, long long e) {
    Modular res = 1; while (e) { if (e&1) res *= a; a *= a; e >>= 1; }
    return res;
  }
  friend Modular inverse(Modular a) { return mexp(a, MOD - 2); }

  Modular& operator/=(Modular const& b) { return *this *= inverse(b); }
  friend Modular operator+(Modular a, Modular const b) { return a += b; }
  friend Modular operator-(Modular a, Modular const b) { return a -= b; }
  friend Modular operator-(Modular const a) { return 0 - a; }
  friend Modular operator*(Modular a, Modular const b) { return a *= b; }
  friend Modular operator/(Modular a, Modular const b) { return a /= b; }
  friend std::ostream& operator<<(std::ostream& os, Modular const& a) {return os << a.value;}
  friend bool operator==(Modular const& a, Modular const& b) {return a.value == b.value;}
  friend bool operator!=(Modular const& a, Modular const& b) {return a.value != b.value;}
};

Modular<M> val[2005][2005];
void calc() {
  val[0][0] = 1;
  for (int i = 0; i < 2002; ++i) {
    for (int j = 0; j <= i; ++j) {
      val[i + 1][j + 1] += val[i][j];
      if (j)  val[i + 1][j - 1] += val[i][j];
    }
  }
}

int main() {

  ios::sync_with_stdio(false);
  cout.tie(nullptr);
  cin.tie(nullptr);

  int n, m;
  cin >> n >> m;

  string s;
  cin >> s;

  int p = 0, mn = 0;

  for (auto c : s) {
    if (c == '(') p++;
    else p--;

    mn = min(mn, p);
  }

  calc();
  Modular<M> ans;
  int sz = n - m;
  for (int len = 0; len <= sz; ++len) {
    for (int pl = -mn; pl <= len; ++pl) {
      int rlen = sz-len, pr = p + pl;
      if (pr > 2000)  continue;
      ans += val[len][pl] * val[rlen][pr];
    }
  }

  cout << ans << '\n';
}


// 037
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define pb push_back
#define MOD 1000000007
#define mod1 1187278649
#define mod2 1149736019
#define ioi cout<<"\n------------ioi------------\n"
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

const ld PI=3.14159265358979323;
const int linf=1000111000111000111LL;
const int inf=1011111111;
const int N=5005;
// global variables...
int n, m, dp[N][N];
string s1;

//functions...
void input(){
    cin>>n>>m;
    cin>>s1;
}

int32_t main()
{
    // #ifndef ONLINE_JUDGE
    //     freopen("inputf.txt", "r", stdin);
    //     freopen("outputf.txt", "w", stdout);
    // #endif

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int test=1;
    // cin>>test;
    while(test--){
        input();
        // LOGIC___________________________
        // Since we only have to complete the partially completeed string.(i.e. we have to fill n-m spaces)
        // We can have a O(n*n) approach.
        // Consider n=1, m=4, string = ')'. So we need to fill 3 characters.
        // Use one loop for keeping 'i' letters as prefix and '3-i' letters as suffix.
        // Also find the minimum balance( opening brackerts-closing brackets) for all the prefix of given string. In the above example it is -1.
        // So while making string 'p' we have to consider only those strings that have balance >= +1 and length = i;

        // precalculating dp array.
        // dp[i][j] => the number of ways to form a sequence having length = 'i' and balance = 'j';
        dp[0][0]=1;
        for(int i=1;i<N;i++){
            dp[i][0]=dp[i-1][1];
            for(int j=1;j<N-1;j++)
                dp[i][j]=(dp[i-1][j-1]+dp[i-1][j+1])%MOD;
        }
        // for(int i=0;i<=10;i++){
        //     for(int j=0;j<=10;j++){
        //         cout<<dp[i][j]<<" ";
        //     }
        //     cout<<endl;
        // }
        // ioi;
        int mn=0, var=0;
        for(int i=0;i<m;i++){
            if(s1[i]=='(')
                var++;
            else
                var--;
            mn=min(mn,var);
        }
        if(var>2000 or var<-2000){
            cout<<"0\n";
            continue;
        }
        // cout<<mn;
        mn=mn*-1;
        // ioi;
        int rem=n-m;
        int ans=0;
        for(int i=0;i<=rem;i++){
            int var1=i;
            int var2=rem-i;
            // cout<<var;
            for(int j=mn;j<2005;j++){
                int var3=dp[var1][j]*dp[var2][((j+var))];
                var3%=MOD;
                ans=(ans+var3)%MOD;
            }
        }
        cout<<ans;
    }
    cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
}


// 037
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define pb push_back
#define MOD 1000000007
#define mod1 1187278649
#define mod2 1149736019
#define ioi cout<<"\n------------ioi------------\n"
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

const ld PI=3.14159265358979323;
const int linf=1000111000111000111LL;
const int inf=1011111111;
const int N=3005;
// global variables...
int n, m, dp[N][N];
string s1;

//functions...
void input(){
    cin>>n>>m;
    cin>>s1;
}

int32_t main()
{
    // #ifndef ONLINE_JUDGE
    //     freopen("inputf.txt", "r", stdin);
    //     freopen("outputf.txt", "w", stdout);
    // #endif

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int test=1;
    // cin>>test;
    while(test--){
        input();
        // LOGIC___________________________
        // Since we only have to complete the partially completeed string.(i.e. we have to fill n-m spaces)
        // We can have a O(n*n) approach.
        // Consider n=1, m=4, string = ')'. So we need to fill 3 characters.
        // Use one loop for keeping 'i' letters as prefix and '3-i' letters as suffix.
        // Also find the minimum balance( opening brackerts-closing brackets) for all the prefix of given string. In the above example it is -1.
        // So while making string 'p' we have to consider only those strings that have balance >= +1 and length = i;

        // precalculating dp array.
        // dp[i][j] => the number of ways to form a sequence having length = 'i' and balance = 'j';
        dp[0][0]=1;
        for(int i=1;i<N;i++){
            dp[i][0]=dp[i-1][1];
            for(int j=1;j<N;j++)
                dp[i][j]=(dp[i-1][j-1]+dp[i-1][j+1])%MOD;
        }
        // for(int i=0;i<=10;i++){
        //     for(int j=0;j<=10;j++){
        //         cout<<dp[i][j]<<" ";
        //     }
        //     cout<<endl;
        // }
        // ioi;
        int mn=0, var=0;
        for(int i=0;i<m;i++){
            if(s1[i]=='(')
                var++;
            else
                var--;
            mn=min(mn,var);
        }
        // cout<<mn;
        mn=mn*-1;
        // ioi;
        int rem=n-m;
        int ans=0;
        for(int i=0;i<=rem;i++){
            int var1=i;
            int var2=rem-i;
            // cout<<var;
            for(int j=mn;j<2005;j++){
                int var3=dp[var1][j]*dp[var2][((j+var))];
                var3%=MOD;
                ans=(ans+var3)%MOD;
            }
        }
        cout<<ans;
    }
    cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
}


// 037
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define pb push_back
#define MOD 1000000007
#define mod1 1187278649
#define mod2 1149736019
#define ioi cout<<"\n------------ioi------------\n"
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

const ld PI=3.14159265358979323;
const int linf=1000111000111000111LL;
const int inf=1011111111;
const int N=3005;
// global variables...
int n, m, dp[N][N];
string s1;

//functions...
void input(){
    cin>>n>>m;
    cin>>s1;
}

int32_t main()
{
    // #ifndef ONLINE_JUDGE
    //     freopen("inputf.txt", "r", stdin);
    //     freopen("outputf.txt", "w", stdout);
    // #endif

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int test=1;
    // cin>>test;
    while(test--){
        input();
        // LOGIC___________________________
        // Since we only have to complete the partially completeed string.(i.e. we have to fill n-m spaces)
        // We can have a O(n*n) approach.
        // Consider n=1, m=4, string = ')'. So we need to fill 3 characters.
        // Use one loop for keeping 'i' letters as prefix and '3-i' letters as suffix.
        // Also find the minimum balance( opening brackerts-closing brackets) for all the prefix of given string. In the above example it is -1.
        // So while making string 'p' we have to consider only those strings that have balance >= +1 and length = i;

        // precalculating dp array.
        // dp[i][j] => the number of ways to form a sequence having length = 'i' and balance = 'j';
        dp[0][0]=1;
        for(int i=1;i<N;i++){
            dp[i][0]=dp[i-1][1];
            for(int j=1;j<N-1;j++)
                dp[i][j]=(dp[i-1][j-1]+dp[i-1][j+1])%MOD;
        }
        // for(int i=0;i<=10;i++){
        //     for(int j=0;j<=10;j++){
        //         cout<<dp[i][j]<<" ";
        //     }
        //     cout<<endl;
        // }
        // ioi;
        int mn=0, var=0;
        for(int i=0;i<m;i++){
            if(s1[i]=='(')
                var++;
            else
                var--;
            mn=min(mn,var);
        }
        // cout<<mn;
        mn=mn*-1;
        // ioi;
        int rem=n-m;
        int ans=0;
        for(int i=0;i<=rem;i++){
            int var1=i;
            int var2=rem-i;
            // cout<<var;
            for(int j=mn;j<2005;j++){
                int var3=dp[var1][j]*dp[var2][((j+var))];
                var3%=MOD;
                ans=(ans+var3)%MOD;
            }
        }
        cout<<ans;
    }
    cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
}


// 037
#include <bits/stdc++.h>
using namespace std;
#define int long long int
#define ld long double
#define pb push_back
#define MOD 1000000007
#define mod1 1187278649
#define mod2 1149736019
#define ioi cout<<"\n------------ioi------------\n"
#define all(x) (x).begin(),(x).end()
#define sz(x) (int)(x).size()

const ld PI=3.14159265358979323;
const int linf=1000111000111000111LL;
const int inf=1011111111;
const int N=5005;
// global variables...
int n, m, dp[N][N];
string s1;

//functions...
void input(){
    cin>>n>>m;
    cin>>s1;
}

int32_t main()
{
    // #ifndef ONLINE_JUDGE
    //     freopen("inputf.txt", "r", stdin);
    //     freopen("outputf.txt", "w", stdout);
    // #endif

    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int test=1;
    // cin>>test;
    while(test--){
        input();
        // LOGIC___________________________
        // Since we only have to complete the partially completeed string.(i.e. we have to fill n-m spaces)
        // We can have a O(n*n) approach.
        // Consider n=1, m=4, string = ')'. So we need to fill 3 characters.
        // Use one loop for keeping 'i' letters as prefix and '3-i' letters as suffix.
        // Also find the minimum balance( opening brackerts-closing brackets) for all the prefix of given string. In the above example it is -1.
        // So while making string 'p' we have to consider only those strings that have balance >= +1 and length = i;

        // precalculating dp array.
        // dp[i][j] => the number of ways to form a sequence having length = 'i' and balance = 'j';
        dp[0][0]=1;
        for(int i=1;i<N;i++){
            dp[i][0]=dp[i-1][1];
            for(int j=1;j<N-1;j++)
                dp[i][j]=(dp[i-1][j-1]+dp[i-1][j+1])%MOD;
        }
        // for(int i=0;i<=10;i++){
        //     for(int j=0;j<=10;j++){
        //         cout<<dp[i][j]<<" ";
        //     }
        //     cout<<endl;
        // }
        // ioi;
        int mn=0, var=0;
        for(int i=0;i<m;i++){
            if(s1[i]=='(')
                var++;
            else
                var--;
            mn=min(mn,var);
        }
        // cout<<mn;
        mn=mn*-1;
        // ioi;
        int rem=n-m;
        int ans=0;
        for(int i=0;i<=rem;i++){
            int var1=i;
            int var2=rem-i;
            // cout<<var;
            for(int j=mn;j<2005;j++){
                int var3=dp[var1][j]*dp[var2][((j+var))];
                var3%=MOD;
                ans=(ans+var3)%MOD;
            }
        }
        cout<<ans;
    }
    cerr<< '\n' << "Time elapsed :" << clock() * 1000.0 / CLOCKS_PER_SEC << " ms\n" ;
}


#include <iostream>
#include <string>
#include <vector>
#include <array>
using namespace std;

long long mod = 1000000000+7;

int main() {
	int n,m;
	string s;
	cin >> n >> m >> s;

	int qtoFalta = n-m;

	int k = n-m+1;
	vector<vector<long long> > dp(k+1,vector<long long>(k+1,0)); //dp[i][j] quantas strings de tamanho i sao validas e possuem saldo abrindo j ?
							 //saldo abrindo: numero abrindo - fechando
							 //note que isso eh simetrico... pode ser usado para o lado direito (onde queremos "validas a direita" e saldo abrindo -j)

	for(int i=0;i<k;i++) dp[0][i] = 0;
	dp[0][0] = 1;
	for(int i=1;i<k;i++) {
		for(int b=0;b<k;b++) {
			//aqui posso abrir ou fechar parenteses...
			dp[i][b] = 0;
			//se abrir...
			if(b>0)
				dp[i][b] += dp[i-1][b-1];
			//se fechar...
			dp[i][b] += dp[i-1][b+1];
		}
	}

	int saldoMinimoEsquerdo = 0;
	int saldoSTotal = 0;
	for(char c:s) {
		if(c=='(') saldoSTotal++;
		else saldoSTotal--;
		if(saldoSTotal < saldoMinimoEsquerdo) saldoMinimoEsquerdo = saldoSTotal;
	}
	saldoMinimoEsquerdo = -saldoMinimoEsquerdo;
	//S poderia ser )))((( --> saldo 0, mas ela exige um lado esquerdo com no minimo saldo 3
	//cerr << saldoMinimoEsquerdo << endl;

	long long ans = 0;
	for(int e=0;e<=qtoFalta;e++) { //todas possibilidades de tamanho para o lado esquerdo...
		for(int saldoE =saldoMinimoEsquerdo;saldoE<=e; saldoE++) {//todas possibilidades de saldo para o lado esquerdo...
			long long numValidasEsquerdo = dp[e][saldoE]; //quanstas strings podemos colocar no lado esquerdo com esse tamanho e esse saldo?

			int qtoFaltaDireita = qtoFalta-e; //qto falta para adicionar a direita?
			//quantas strings de tamanho qtoFaltaDireita podemos por a direita?
			//essas strings devem ser "validas a direita" e ter saldo -(saldoE+saldoSTotal)
			//por simetria, eh o mesmo que saldoE+saldoSTotal

			if(saldoE+saldoSTotal <= qtoFaltaDireita) //a quantidade que falta de caracteres a direita da para atingir o saldo?
				ans += numValidasEsquerdo * dp[qtoFaltaDireita][saldoE+saldoSTotal];
			ans %= mod;
		}
	}
	cout << ans << endl;
}


#include <iostream>
#include <string>
#include <vector>
#include <array>
using namespace std;

long long mod = 1000000000+7;

int main() {
	int n,m;
	string s;
	cin >> n >> m >> s;

	int qtoFalta = n-m;

	int k = n-m+1;
	vector<vector<long long> > dp(k+1,vector<long long>(k+1,0)); //dp[i][j] quantas strings de tamanho i sao validas e possuem saldo abrindo j ?
							 //saldo abrindo: numero abrindo - fechando
							 //note que isso eh simetrico... pode ser usado para o lado direito (onde queremos "validas a direita" e saldo abrindo -j)

	for(int i=0;i<k;i++) dp[0][i] = 0;
	dp[0][0] = 1;
	for(int i=1;i<k;i++) {
		for(int b=0;b<k;b++) {
			//aqui posso abrir ou fechar parenteses...
			dp[i][b] = 0;
			//se abrir...
			if(b>0)
				dp[i][b] += dp[i-1][b-1];
			//se fechar...
			dp[i][b]%=mod;

			dp[i][b] += dp[i-1][b+1];
			dp[i][b]%=mod;
		}
	}

	int saldoMinimoEsquerdo = 0;
	int saldoSTotal = 0;
	for(char c:s) {
		if(c=='(') saldoSTotal++;
		else saldoSTotal--;
		if(saldoSTotal < saldoMinimoEsquerdo) saldoMinimoEsquerdo = saldoSTotal;
	}
	saldoMinimoEsquerdo = -saldoMinimoEsquerdo;
	//S poderia ser )))((( --> saldo 0, mas ela exige um lado esquerdo com no minimo saldo 3
	//cerr << saldoMinimoEsquerdo << endl;

	long long ans = 0;
	for(int e=0;e<=qtoFalta;e++) { //todas possibilidades de tamanho para o lado esquerdo...
		for(int saldoE =saldoMinimoEsquerdo;saldoE<=e; saldoE++) {//todas possibilidades de saldo para o lado esquerdo...
			long long numValidasEsquerdo = dp[e][saldoE]; //quanstas strings podemos colocar no lado esquerdo com esse tamanho e esse saldo?

			int qtoFaltaDireita = qtoFalta-e; //qto falta para adicionar a direita?
			//quantas strings de tamanho qtoFaltaDireita podemos por a direita?
			//essas strings devem ser "validas a direita" e ter saldo -(saldoE+saldoSTotal)
			//por simetria, eh o mesmo que saldoE+saldoSTotal

			if(saldoE+saldoSTotal <= qtoFaltaDireita) //a quantidade que falta de caracteres a direita da para atingir o saldo?
				ans += numValidasEsquerdo * dp[qtoFaltaDireita][saldoE+saldoSTotal];
			ans %= mod;
		}
	}
	cout << ans << endl;
}


#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define DFOR(i,a,b) for(int i=a;i>=b;--i)
#define LL long long
#define fi first
#define se second
#define filename "F."
using namespace std;
const int N=2000+3;
const LL mod = 1e9+7;
LL dp[N][N] ;
int n,m;
string s;
int main()
{
    ios::sync_with_stdio(0) ;
    cin.tie(0) ; cout.tie(0) ;

    cin >> n >> m;
    cin >> s;
    int mn = 1e9,cur = 0;
    FOR(i,1,m)
    {
        if(s[i-1]=='(') cur ++ ;
        else cur --;
        mn = min(mn,cur) ;
    }
    dp[0][0] = 1;

    FOR(i,1,n-m){
          dp[i][0] = dp[i-1][1] ;
          FOR(j,1,i) dp[i][j] = (dp[i-1][j-1] + dp[i-1][j+1] )%mod ;
    }
    LL kq = 0;
    FOR(i,0,n-m)
    FOR(j,0,i) if( j+mn >=0 && j+cur <=2000 )
    {
     //   cerr<< i<<" " <<j<<" "<<n-m-i<<" "<<j+cur <<'\n';
        kq = ( kq + (dp[i][j]* dp[n-m-i][j+cur] )%mod )%mod ;
    }
    cout  << kq;
}


#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define DFOR(i,a,b) for(int i=a;i>=b;--i)
#define LL long long
#define fi first
#define se second
#define filename "F."
using namespace std;
const int N=2000+3;
const LL mod = 1e9+7;
LL dp[N][N] ;
int n,m;
string s;
int main()
{
    ios::sync_with_stdio(0) ;
    cin.tie(0) ; cout.tie(0) ;
    cin >> n >> m;
    cin >> s;
    int mn = 1e9,cur = 0;
    FOR(i,1,m)
    {
        if(s[i-1]=='(') cur ++ ;
        else cur --;
        mn = min(mn,cur) ;
    }
    dp[0][0] = 1;

    FOR(i,1,n-m){
          dp[i][0] = dp[i-1][1] ;
          FOR(j,1,i) dp[i][j] = (dp[i-1][j-1] + dp[i-1][j+1] )%mod ;
    }
    LL kq = 0;
    FOR(i,0,n-m)
    FOR(j,0,i) if( j+mn >=0  )
    {
        kq = ( kq + (dp[i][j]* dp[n-m-i][j+mn] )%mod )%mod ;
    }
    cout  << kq;
}


#include <bits/stdc++.h>
#define FOR(i,a,b) for(int i=a;i<=b;++i)
#define DFOR(i,a,b) for(int i=a;i>=b;--i)
#define LL long long
#define fi first
#define se second
#define filename "F."
using namespace std;
const int N=2000+3;
const LL mod = 1e9+7;
LL dp[N][N] ;
int n,m;
string s;
int main()
{
    ios::sync_with_stdio(0) ;
    cin.tie(0) ; cout.tie(0) ;
    cin >> n >> m;
    cin >> s;
    int mn = 1e9,cur = 0;
    FOR(i,1,m)
    {
        if(s[i-1]=='(') cur ++ ;
        else cur --;
        mn = min(mn,cur) ;
    }
    dp[0][0] = 1;

    FOR(i,1,n-m){
          dp[i][0] = dp[i-1][1] ;
          FOR(j,1,i) dp[i][j] = (dp[i-1][j-1] + dp[i-1][j+1] )%mod ;
    }
    LL kq = 0;
    FOR(i,0,n-m)
    FOR(j,0,i) if( j+mn >=0 )
    {
      //  cerr<< i<<" " <<j<<" "<<n-m-i<<" "<<j+cur <<'\n';
        kq = ( kq + (dp[i][j]* dp[n-m-i][j+cur] )%mod )%mod ;
    }
    cout  << kq;
}


/***************************/
/** Author : thantrongtri3 */
/***************************/
#include <bits/stdc++.h>

using namespace std;

namespace IO{
    void setIn(string s) {freopen(s.c_str(), "r", stdin);}
    void setOut(string s) {freopen(s.c_str(), "w", stdout);}
    void setIO(string s = ""){
        ios_base::sync_with_stdio(false);
        cin.tie(0); cout.tie(0);
        #ifndef ONLINE_JUDGE
            cin.exceptions(cin.failbit);
        #endif // ONLINE_JUDGE
        if (s.size()){
            setIn(s+".inp");
            setOut(s+".out");
        } else{
            #ifndef ONLINE_JUDGE
                freopen("input.txt", "r", stdin);
            #endif // ONLINE_JUDGE
        }
    }
}

using namespace IO;

namespace Function{
    template <typename T1, typename T2> void amax(T1 &a, T2 b){
        assert(!(typeid(a).name() == typeid(int).name() && typeid(b).name() == typeid(long long).name()));
        if (a < b) a = b;
    }
    template <typename T1, typename T2> void amin(T1 &a, T2 b) {if (a > b) a = b;}
    template <typename T> void compress(T &a){
        sort(a.begin(), a.end());
        a.resize(unique(a.begin(), a.end()) - a.begin());
    }
    template <typename T1, typename T2, typename T3> int position(T1 Begin, T2 sz, T3 val, bool type = 0){
        if (type == 0){
            return lower_bound(Begin, Begin + sz, val) - Begin;
        }
        return upper_bound(Begin, Begin + sz, val) - Begin;
    }
    template <typename T> long long sqr(T x) {return 1LL*x*x;}
    template <typename T1, typename T2> long long GCD(T1 a, T2 b) {return b == 0 ? a : GCD(b, a%b);}
    template <typename T1, typename T2> long long LCM(T1 a, T2 b) {return 1LL*a/GCD(a, b)*b;}
}

using namespace Function;

namespace Output{
    void print(int x) {cout << x << "\n";}
    void print(unsigned int x) {cout << x << "\n";}
    void print(long unsigned int x) {cout << x << "\n";}
    void print(long long x) {cout << x << "\n";}
    void print(unsigned long long x) {cout << x << "\n";}
    void print(float x) {cout << x << "\n";}
    void print(double x) {cout << x << "\n";}
    void print(long double x) {cout << x << "\n";}
    void print(char x) {cout << x << "\n";}
    void print(char* x) {cout << x << "\n";}
    void print(unsigned char x) {cout << x << "\n";}
    void print(const char* x) {cout << x << "\n";}
    void print(string x) {cout << x << "\n";}
    void print(bool x) {cout << x << "\n";}

    template <class T, class... Ts> void print(T t, Ts... ts){
        cout << t << " ";
        print(ts...);
    }

    template <typename T1, typename T2> void print(pair <T1, T2> a) {print(a.first, a.second);}
    template <typename T> void print(T a){
        for(auto it : a){
            print(it);
        }
    }

    template <class T, class... Ts> void prine(T t, Ts... ts){
        print(t, ts...);
        exit(0);
    }
}

using namespace Output;

typedef pair <int, int> pii;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
const int INF = 1e9;
const long long INFL = 1e18;
const int MOD = 1e9+7;
const int N = 2e3+10;

template<int _MOD> class Mod{
private:
    int x;
public:
    static const int MOD = _MOD;

    Mod() : x(0) {}
    Mod(long long _x) : x(_x % MOD) {if (x < 0) x += MOD;}
    Mod operator - () const{
        Mod res = *this;
        res.x = MOD - res.x;
        return res;
    }
    explicit operator int () const {return x;}

    friend bool operator == (const Mod& A, const Mod& B) {return A.x == B.x;}
    friend bool operator != (const Mod& A, const Mod& B) {return A.x != B.x;}
    friend bool operator < (const Mod& A, const Mod& B) {return A.x < B.x;}
    friend bool operator > (const Mod& A, const Mod& B) {return A.x > B.x;}
    friend bool operator <= (const Mod& A, const Mod& B) {return A.x <= B.x;}
    friend bool operator >= (const Mod& A, const Mod& B) {return A.x >= B.x;}

    template<typename T1, typename T2> long long inv(T1 A, T2 B){
        assert(B > 0);
        if (B == 1) return 0;
        A %= B;
        if (A < 0) A += B;
        assert(A != 0);
        if (A == 1) return 1;
        return B - inv(B, A) * B / A;
    }

    Mod& operator += (const Mod& A){
        x += A.x;
        if (x >= MOD) x -= MOD;
        return *this;
    }

    Mod& operator -= (const Mod& A){
        x -= A.x;
        if (x < 0) x += MOD;
        return *this;
    }

    Mod& operator *= (const Mod& A){
        x = (1LL * x * A.x) % MOD;
        return *this;
    }

    Mod& operator /= (const Mod& A){
        return *this *= Mod(inv(A.x, MOD));
    }

    Mod& operator ^= (long long A){
        Mod res = 1;
        for(; A > 0; A >>= 1){
            if (A&1){
                res *= x;
            }
            x = (1LL*x*x) % MOD;
        }
        x = res.x;
        return *this;
    }

    Mod& operator <<= (long long A){
        return *this *= Mod(2) ^ A;
    }

    Mod& operator >>= (long long A){
        return *this /= Mod(2) ^ A;
    }

    friend Mod operator + (const Mod& A, const Mod& B) {return Mod(A) += B;}
    friend Mod operator - (const Mod& A, const Mod& B) {return Mod(A) -= B;}
    friend Mod operator * (const Mod& A, const Mod& B) {return Mod(A) *= B;}
    friend Mod operator / (const Mod& A, const Mod& B) {return Mod(A) /= B;}
    friend Mod operator ^ (const Mod& A, const long long& B) {return Mod(A) ^= B;}
    friend Mod operator << (const Mod& A, const long long& B) {return Mod(A) <<= B;}
    friend Mod operator >> (const Mod& A, const long long& B) {return Mod(A) >>= B;}

    friend istream& operator >> (istream& stream, Mod& A){
        stream >> A.x;
        return stream;
    }
};

using num = Mod<MOD>;

num dp[N][N];

int main()
{
    setIO();

    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;

    int mn = 0;
    int val = 0;
    for(char x : s){
        val += (x == '(' ? 1 : -1);
        amin(mn, val);
    }

    n -= m;
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= i; j++){
            dp[i][j] = dp[i-1][j+1];
            if (j > 0){
                dp[i][j] += dp[i-1][j-1];
            }
        }
    }

    num res = 0;
    for(int i = 0; i <= n; i++){
        for(int j = -mn; j <= i; j++){
            if (val + j > n-i){
                continue;
            }
            res += dp[i][j] * dp[n-i][val+j];
        }
    }

    print((int)res);
    return 0;
}


/***************************/
/** Author : thantrongtri3 */
/***************************/
#include <bits/stdc++.h>

using namespace std;

namespace IO{
    void setIn(string s) {freopen(s.c_str(), "r", stdin);}
    void setOut(string s) {freopen(s.c_str(), "w", stdout);}
    void setIO(string s = ""){
        ios_base::sync_with_stdio(false);
        cin.tie(0); cout.tie(0);
        #ifndef ONLINE_JUDGE
            cin.exceptions(cin.failbit);
        #endif // ONLINE_JUDGE
        if (s.size()){
            setIn(s+".inp");
            setOut(s+".out");
        } else{
            #ifndef ONLINE_JUDGE
                freopen("input.txt", "r", stdin);
            #endif // ONLINE_JUDGE
        }
    }
}

using namespace IO;

namespace Function{
    template <typename T1, typename T2> void amax(T1 &a, T2 b){
        assert(!(typeid(a).name() == typeid(int).name() && typeid(b).name() == typeid(long long).name()));
        if (a < b) a = b;
    }
    template <typename T1, typename T2> void amin(T1 &a, T2 b) {if (a > b) a = b;}
    template <typename T> void compress(T &a){
        sort(a.begin(), a.end());
        a.resize(unique(a.begin(), a.end()) - a.begin());
    }
    template <typename T1, typename T2, typename T3> int position(T1 Begin, T2 sz, T3 val, bool type = 0){
        if (type == 0){
            return lower_bound(Begin, Begin + sz, val) - Begin;
        }
        return upper_bound(Begin, Begin + sz, val) - Begin;
    }
    template <typename T> long long sqr(T x) {return 1LL*x*x;}
    template <typename T1, typename T2> long long GCD(T1 a, T2 b) {return b == 0 ? a : GCD(b, a%b);}
    template <typename T1, typename T2> long long LCM(T1 a, T2 b) {return 1LL*a/GCD(a, b)*b;}
}

using namespace Function;

namespace Output{
    void print(int x) {cout << x << "\n";}
    void print(unsigned int x) {cout << x << "\n";}
    void print(long unsigned int x) {cout << x << "\n";}
    void print(long long x) {cout << x << "\n";}
    void print(unsigned long long x) {cout << x << "\n";}
    void print(float x) {cout << x << "\n";}
    void print(double x) {cout << x << "\n";}
    void print(long double x) {cout << x << "\n";}
    void print(char x) {cout << x << "\n";}
    void print(char* x) {cout << x << "\n";}
    void print(unsigned char x) {cout << x << "\n";}
    void print(const char* x) {cout << x << "\n";}
    void print(string x) {cout << x << "\n";}
    void print(bool x) {cout << x << "\n";}

    template <class T, class... Ts> void print(T t, Ts... ts){
        cout << t << " ";
        print(ts...);
    }

    template <typename T1, typename T2> void print(pair <T1, T2> a) {print(a.first, a.second);}
    template <typename T> void print(T a){
        for(auto it : a){
            print(it);
        }
    }

    template <class T, class... Ts> void prine(T t, Ts... ts){
        print(t, ts...);
        exit(0);
    }
}

using namespace Output;

typedef pair <int, int> pii;

const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, 1, -1};
const int INF = 1e9;
const long long INFL = 1e18;
const int MOD = 1e9+7;
const int N = 2e3+10;

template<int _MOD> class Mod{
private:
    int x;
public:
    static const int MOD = _MOD;

    Mod() : x(0) {}
    Mod(long long _x) : x(_x % MOD) {if (x < 0) x += MOD;}
    Mod operator - () const{
        Mod res = *this;
        res.x = MOD - res.x;
        return res;
    }
    explicit operator int () const {return x;}

    friend bool operator == (const Mod& A, const Mod& B) {return A.x == B.x;}
    friend bool operator != (const Mod& A, const Mod& B) {return A.x != B.x;}
    friend bool operator < (const Mod& A, const Mod& B) {return A.x < B.x;}
    friend bool operator > (const Mod& A, const Mod& B) {return A.x > B.x;}
    friend bool operator <= (const Mod& A, const Mod& B) {return A.x <= B.x;}
    friend bool operator >= (const Mod& A, const Mod& B) {return A.x >= B.x;}

    template<typename T1, typename T2> long long inv(T1 A, T2 B){
        assert(B > 0);
        if (B == 1) return 0;
        A %= B;
        if (A < 0) A += B;
        assert(A != 0);
        if (A == 1) return 1;
        return B - inv(B, A) * B / A;
    }

    Mod& operator += (const Mod& A){
        x += A.x;
        if (x >= MOD) x -= MOD;
        return *this;
    }

    Mod& operator -= (const Mod& A){
        x -= A.x;
        if (x < 0) x += MOD;
        return *this;
    }

    Mod& operator *= (const Mod& A){
        x = (1LL * x * A.x) % MOD;
        return *this;
    }

    Mod& operator /= (const Mod& A){
        return *this *= Mod(inv(A.x, MOD));
    }

    Mod& operator ^= (long long A){
        Mod res = 1;
        for(; A > 0; A >>= 1){
            if (A&1){
                res *= x;
            }
            x = (1LL*x*x) % MOD;
        }
        x = res.x;
        return *this;
    }

    Mod& operator <<= (long long A){
        return *this *= Mod(2) ^ A;
    }

    Mod& operator >>= (long long A){
        return *this /= Mod(2) ^ A;
    }

    friend Mod operator + (const Mod& A, const Mod& B) {return Mod(A) += B;}
    friend Mod operator - (const Mod& A, const Mod& B) {return Mod(A) -= B;}
    friend Mod operator * (const Mod& A, const Mod& B) {return Mod(A) *= B;}
    friend Mod operator / (const Mod& A, const Mod& B) {return Mod(A) /= B;}
    friend Mod operator ^ (const Mod& A, const long long& B) {return Mod(A) ^= B;}
    friend Mod operator << (const Mod& A, const long long& B) {return Mod(A) <<= B;}
    friend Mod operator >> (const Mod& A, const long long& B) {return Mod(A) >>= B;}

    friend istream& operator >> (istream& stream, Mod& A){
        stream >> A.x;
        return stream;
    }
};

using num = Mod<MOD>;

num dp[N][N];

int main()
{
    setIO();

    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;

    int mn = 0;
    int val = 0;
    for(char x : s){
        val += (x == '(' ? 1 : -1);
        amin(mn, val);
    }

    n -= m;
    dp[0][0] = 1;
    for(int i = 1; i <= n; i++){
        for(int j = 0; j <= i; j++){
            dp[i][j] = dp[i-1][j+1];
            if (j > 0){
                dp[i][j] += dp[i-1][j-1];
            }
        }
    }

    num res = 0;
    for(int i = 0; i <= n; i++){
        for(int j = mn; j <= i; j++){
            if (val + j > n-i){
                continue;
            }
            res += dp[i][j] * dp[n-i][val+j];
        }
    }

    print((int)res);
    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define st first
#define nd second
typedef long long LL;
typedef pair <int, int> PII;
typedef pair <LL, LL> PLL;

const int N = 1e5, M = 2e3;
const LL MOD = 1e9 + 7;
char Tab[N + 1];
LL DP[M + 1][M + 1];

int main()
{
    int n, m;
    scanf("%d %d %s", &n, &m, Tab);
    string text = Tab;

    DP[0][0] = 1;

    for (int i = 1; i <= n - m; ++i)
        for (int j = 0; j <= i; ++j)
        {
            if (j != 0)
                DP[i][j] = (DP[i][j] + DP[i - 1][j - 1]) % MOD;
            DP[i][j] = (DP[i][j] + DP[i - 1][j + 1]) % MOD;
        }

    int o = 0, c = 0;

    for (int i = 0; i < m; ++i)
        if (text[i] == '(')
            ++o;
        else
        {
            if (o)
                --o;
            else
                ++c;
        }

    LL result = 0LL;

    for (int i = 0; i <= n - m; ++i)
        for (int j = c; j <= i; ++j)
            result = (result + DP[i][j] * DP[n - m - i][j - c + o]) % MOD;

    printf("%lld", result);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define st first
#define nd second
typedef long long LL;
typedef pair <int, int> PII;
typedef pair <LL, LL> PLL;

const int N = 1e5, M = 2e3;
const LL MOD = 1e9 + 7LL;
char Tab[N + 1];
LL DP[M + 1][M + 1];

int main()
{
    int n, m;
    scanf("%d %d %s", &n, &m, Tab);
    string text = Tab;

    DP[0][0] = 1LL;

    for (int i = 1; i <= n - m; ++i)
        for (int j = 0; j <= i; ++j)
        {
            if (j != 0)
                DP[i][j] = (DP[i][j] + DP[i - 1][j - 1]) % MOD;
            DP[i][j] = (DP[i][j] + DP[i - 1][j + 1]) % MOD;
        }

    int o = 0, c = 0;

    for (int i = 0; i < m; ++i)
        if (text[i] == '(')
            ++o;
        else
        {
            if (o)
                --o;
            else
                ++c;
        }

    LL result = 0LL;

    for (int i = 0; i <= n - m; ++i)
        for (int j = c; j <= i; ++j)
            result = (result + DP[i][j] * DP[n - m - i][j - c + o]) % MOD;

    printf("%lld", (result % MOD + MOD) % MOD);

    return 0;
}


#include <bits/stdc++.h>
using namespace std;

#define st first
#define nd second
typedef long long LL;
typedef pair <int, int> PII;
typedef pair <LL, LL> PLL;

const int N = 1e5, M = 2e3;
const LL MOD = 1e9 + 7LL;
char Tab[N + 1];
LL DP[M + 1][M + 1];

int main()
{
    int n, m;
    scanf("%d %d %s", &n, &m, Tab);
    string text = Tab;

    DP[0][0] = 1LL;

    for (int i = 1; i <= n - m; ++i)
        for (int j = 0; j <= i; ++j)
        {
            if (j != 0)
                DP[i][j] = (DP[i][j] + DP[i - 1][j - 1]) % MOD;
            DP[i][j] = (DP[i][j] + DP[i - 1][j + 1]) % MOD;
        }

    int o = 0, c = 0;

    for (int i = 0; i < m; ++i)
        if (text[i] == '(')
            ++o;
        else
        {
            if (o)
                --o;
            else
                ++c;
        }

    LL result = 0LL;

    for (int i = 0; i <= n - m; ++i)
        for (int j = c; j <= i; ++j)
            if (j - c + o <= M)
                result = (result + DP[i][j] * DP[n - m - i][j - c + o]) % MOD;

    printf("%lld", result);

    return 0;
}


#include<bits/stdc++.h>
#define int long long
using namespace std;
const int p=1e9+7;
int dp[2005][2005],c,ans;
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    dp[0][0]=1;
    for(int i=1;i<=2000;i++)
    {
        for(int j=0;j<i;j++)
            dp[i][j]=dp[i-1][j];
        for(int j=1;j<=i;j++)
            dp[i][j]=(dp[i][j]+dp[i][j-1])%p;
    }
    int n,m;cin>>n>>m;
    string s;cin>>s;
    for(int i=0;i<m;i++)
        if(s[i]=='(')
            c++;
        else
            c--;
    c=abs(c);
    if(c>(n-m))
        return cout<<0,0;
    int k=(n-m)-c;
    for(int i=0;i<=k/2+c;i++)
    {
        for(int j=0;j<=k/2;j++)
        {
            if(k/2-j-i>=0)
            {
                ans+=(dp[k/2-j][i]*dp[c+k/2-i][j])%p;
            }
        }
    }
    ans=(p+ans%p)%p;
    cout<<ans;

}


#include<bits/stdc++.h>
#define int long long
using namespace std;
const int p=1e9+7;
int dp[2005][2005],c,ans,q;
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    dp[0][0]=1;
    for(int i=1;i<=2000;i++)
	{
		for(int j=0;j<=i;j++)
		{
			if(j>0)
			dp[i][j]+=dp[i-1][j-1];
			if(dp[i][j]>=p)
			dp[i][j]-=p;
			dp[i][j]+=dp[i-1][j+1];
			if(dp[i][j]>=p)
			dp[i][j]-=p;
		}
	}
    int n,m;cin>>n>>m;
    string s;cin>>s;
    for(int i=0;i<m;i++)
    {
        if(s[i]=='(')
            c++;
        else
            c--;
        q=min(q,c);
    }

    for(int i=0;i<=n-m;i++)
    {
        for(int j=-q;j<=i;j++)
        {
            if(n-m+c>2000)
                continue;
            ans+=(dp[i][j]*dp[n-m-i][j+c])%p;
        }
    }
    ans=(p+ans%p)%p;
    cout<<ans;

}


#include<bits/stdc++.h>
#define int long long
using namespace std;
const int p=1e9+7;
int dp[2005][2005],c,ans,q;
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    dp[0][0]=1;
    for(int i=1;i<=2000;i++)
    {
        for(int j=0;j<i;j++)
        {
            dp[i][j]=dp[i-1][j];
            dp[i][j]=dp[j][i];
        }
        for(int j=1;j<=i;j++)
        {
            dp[i][j]=(dp[i][j]+dp[i][j-1])%p;
            dp[j][i]=dp[i][j];
        }
    }
    int n,m;cin>>n>>m;
    string s;cin>>s;
    for(int i=0;i<m;i++)
    {
        if(s[i]=='(')
            c++;
        else
            c--;
        q=min(q,c);
    }
    for(int i=0;i<=n-m;i++)
    {
        for(int j=-q;j<=i;j++)
        {
            if(n-m+c>2000)
                continue;
            ans+=(dp[i][j]*dp[n-m-i][j+c])%p;
        }
    }
    ans=(p+ans%p)%p;
    cout<<ans;

}


#include<bits/stdc++.h>
#define int long long
using namespace std;
int dp[2005][2005],c,ans;
int32_t main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    dp[0][0]=1;
    for(int i=1;i<=2000;i++)
    {
        for(int j=0;j<i;j++)
            dp[i][j]=dp[i-1][j];
        for(int j=1;j<=i;j++)
            dp[i][j]+=dp[i][j-1];
    }
    int n,m;cin>>n>>m;
    string s;cin>>s;
    for(int i=0;i<m;i++)
        if(s[i]=='(')
            c++;
        else
            c--;
    c=abs(c);
    if(c>(n-m))
        return cout<<0,0;
    int k=(n-m)-c;
    for(int i=0;i<=k/2+c;i++)
    {
        for(int j=0;j<=k/2;j++)
        {
            if(k/2-j-i>=0)
            {
                ans+=dp[k/2-j][i]*dp[c+k/2-i][j];
            }
        }
    }
    cout<<ans;

}


/* Author : samarth
   Handle : ssg_13 */

//----------------------template begins--------------------------------//
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
using namespace std::chrono;

#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define eb emplace_back //faster than pb
#define pb push_back
#define Db(x) cout << '>' << #x << ':' << x << endl;
#define forn(i,n) for(ll i=0;i<n;i++)
#define rforn(i,n) for(ll i=n-1;i>=0;i--)
#define forne(i,n) for(ll i=1;i<=n;i++)
#define forse(i,s,e) for(ll i=s;i<e;i++)
#define rforse(i,s,e) for(ll i=e;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define PT palindromeTest	//Input - string, int, ll, l
#define GS generateSubsets	//Input - n		//Return - vector<vector<int>>
#define GP generatePermutations //Input - int n 	//Return - vector<vector<int>>
#define PF primeFactorization	//Input - ll	//Return - vector<ll>
#define nCr nCrModPFermat   //Input - n, r, p	//Return - nCr mod p
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// find_by_order(i) return pointer to ith index in ordered set

const ll MOD = 1000000007;
ll modpow(ll a,ll b,ll m=MOD) {a%=m;ll res=1;while(b){if(b&1)res=res*a%m;a=a*a%m;b>>=1;}return res;}
ll bpow(ll a, ll b) {ll res = 1;while(b){if(b&1)res=res*a;a=a*a;b>>=1;}return res;}
ll modinv(ll a){return modpow(a,MOD-2,MOD);}
void graph(vector<ll> adj[], ll m){ll x, y; forn(i, m){cin>>x>>y;adj[x-1].pb(y-1);adj[y-1].pb(x-1);}}
ll sum() { return 0; }
template<typename T, typename... Args>
auto sum(T a, Args... args) { return a + sum(args...); }

const ll INF=(ll)1e18;
const int MAXN = 2001;
//----------------------template ends--------------------------------//
ll dp[MAXN][MAXN];
ll calc(ll n1,ll n2,ll ex,ll lb,ll ub)
{
    if(n2>n1) return 0;
    if(n1>ub) return 0;
    if(n1==ub) return 1+(n1>lb);
    if(dp[n1][n2]!=-1) return dp[n1][n2];
    ll r=0;
    if(n1<lb) r=(calc(n1+1,n2,ex,lb,ub)+calc(n1,n2+1,ex,lb,ub))%MOD;
    else r= ((calc(n1+1,n2,ex,lb,ub)+calc(n1,n2+1,ex,lb,ub))%MOD+(calc(n1+1+ex,n2,ex,lb,ub)+calc(n1+ex,n2+1,ex,lb,ub)%MOD))%MOD;
    dp[n1][n2]=r;
    // error(n1,n2,r);
    return r;
}
int main()
{
fast;
cout << fixed << setprecision(11);
cerr << fixed << setprecision(6);
auto start = high_resolution_clock::now();
ll T;
// cin>>T;
T=1;
while(T--)
{
    ll n,m;
    cin>>n>>m;
    string s;
    cin>>s;
    if(n%2) {cout<<"0\n";continue;}
    ll mn=0,val=0,cm=0;
    forn(i,m) {
        val+=(s[i]=='(')?1:-1;
        cm+=(s[i]=='(');
        mn=min(mn,val);
    }
    mn*=-1;
    if(cm>n/2 || mn>(n/2-cm)) {cout<<"0\n";continue;}
    fill(dp,-1);
    // error(mn,cm);
    cout<<calc(0,0,cm,mn,n/2-cm)<<'\n';
}
auto stop = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stop - start);
// cout << "Time taken by function: "
//          << duration.count() << " microseconds" << endl;
}


/* Author : samarth
   Handle : ssg_13 */

//----------------------template begins--------------------------------//
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
using namespace std::chrono;

#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define eb emplace_back //faster than pb
#define pb push_back
#define Db(x) cout << '>' << #x << ':' << x << endl;
#define forn(i,n) for(ll i=0;i<n;i++)
#define rforn(i,n) for(ll i=n-1;i>=0;i--)
#define forne(i,n) for(ll i=1;i<=n;i++)
#define forse(i,s,e) for(ll i=s;i<e;i++)
#define rforse(i,s,e) for(ll i=e;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define PT palindromeTest	//Input - string, int, ll, l
#define GS generateSubsets	//Input - n		//Return - vector<vector<int>>
#define GP generatePermutations //Input - int n 	//Return - vector<vector<int>>
#define PF primeFactorization	//Input - ll	//Return - vector<ll>
#define nCr nCrModPFermat   //Input - n, r, p	//Return - nCr mod p
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// find_by_order(i) return pointer to ith index in ordered set

const ll MOD = 1000000007;
ll modpow(ll a,ll b,ll m=MOD) {a%=m;ll res=1;while(b){if(b&1)res=res*a%m;a=a*a%m;b>>=1;}return res;}
ll bpow(ll a, ll b) {ll res = 1;while(b){if(b&1)res=res*a;a=a*a;b>>=1;}return res;}
ll modinv(ll a){return modpow(a,MOD-2,MOD);}
void graph(vector<ll> adj[], ll m){ll x, y; forn(i, m){cin>>x>>y;adj[x-1].pb(y-1);adj[y-1].pb(x-1);}}
ll sum() { return 0; }
template<typename T, typename... Args>
auto sum(T a, Args... args) { return a + sum(args...); }

const ll INF=(ll)1e18;
const int MAXN = 2001;
//----------------------template ends--------------------------------//
ll dp[MAXN+2][MAXN+2];

int main()
{
fast;
cout << fixed << setprecision(11);
cerr << fixed << setprecision(6);
auto start = high_resolution_clock::now();
dp[0][0]=1;
forne(i,MAXN-1) forn(j,i+1)
{
    dp[i][j]=dp[i-1][j+1];
    if(j) dp[i][j]= (dp[i][j]+dp[i-1][j-1])%MOD;
}
ll T;
// cin>>T;
T=1;
while(T--)
{
    ll n,m;
    cin>>n>>m;
    string s;
    cin>>s;
    if(n%2) {cout<<"0\n";continue;}
    ll mn=0,val=0,cm=0;
    forn(i,m) {
        val+=(s[i]=='(')?1:-1;
        cm+=(s[i]=='(');
        mn=min(mn,val);
    }
    if(cm>n/2 || mn>(n/2-cm)) {cout<<"0\n";continue;}
    ll ans=0;
    forn(i,n-m+1)
    {
        forn(j,i+1)
        {
            if(j+mn>=0) ans= (ans+(dp[i][j]*dp[n-m-i][j+val])%MOD)%MOD;
        }
    }
    cout<<ans<<'\n';
}
auto stop = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stop - start);
// cout << "Time taken by function: "
//          << duration.count() << " microseconds" << endl;
}


/* Author : samarth
   Handle : ssg_13 */

//----------------------template begins--------------------------------//
#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;
using namespace std::chrono;

#define fast ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define F first
#define S second
#define mp make_pair
#define mt make_tuple
#define eb emplace_back //faster than pb
#define pb push_back
#define Db(x) cout << '>' << #x << ':' << x << endl;
#define forn(i,n) for(ll i=0;i<n;i++)
#define rforn(i,n) for(ll i=n-1;i>=0;i--)
#define forne(i,n) for(ll i=1;i<=n;i++)
#define forse(i,s,e) for(ll i=s;i<e;i++)
#define rforse(i,s,e) for(ll i=e;i>=s;i--)
#define all(x) x.begin(),x.end()
#define sz(x) (ll)x.size()
#define fill(a,x) memset(a,x,sizeof a);
#define trav(a,x) for(auto &a:x)
#define PT palindromeTest	//Input - string, int, ll, l
#define GS generateSubsets	//Input - n		//Return - vector<vector<int>>
#define GP generatePermutations //Input - int n 	//Return - vector<vector<int>>
#define PF primeFactorization	//Input - ll	//Return - vector<ll>
#define nCr nCrModPFermat   //Input - n, r, p	//Return - nCr mod p
#define error(args...) { string _s = #args; replace(_s.begin(), _s.end(), ',', ' '); stringstream _ss(_s); istream_iterator<string> _it(_ss); err(_it, args); }
void err(istream_iterator<string> it) {}
template<typename T, typename... Args>
void err(istream_iterator<string> it, T a, Args... args) {
	cerr << *it << " = " << a << endl;
	err(++it, args...);
}

typedef long long ll;
typedef pair<ll,ll> pll;
typedef vector<ll> vll;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> ordered_set;
// find_by_order(i) return pointer to ith index in ordered set

const ll MOD = 1000000007;
ll modpow(ll a,ll b,ll m=MOD) {a%=m;ll res=1;while(b){if(b&1)res=res*a%m;a=a*a%m;b>>=1;}return res;}
ll bpow(ll a, ll b) {ll res = 1;while(b){if(b&1)res=res*a;a=a*a;b>>=1;}return res;}
ll modinv(ll a){return modpow(a,MOD-2,MOD);}
void graph(vector<ll> adj[], ll m){ll x, y; forn(i, m){cin>>x>>y;adj[x-1].pb(y-1);adj[y-1].pb(x-1);}}
ll sum() { return 0; }
template<typename T, typename... Args>
auto sum(T a, Args... args) { return a + sum(args...); }

const ll INF=(ll)1e18;
const int MAXN = 2001;
//----------------------template ends--------------------------------//
ll dp[MAXN][MAXN];

int main()
{
fast;
cout << fixed << setprecision(11);
cerr << fixed << setprecision(6);
auto start = high_resolution_clock::now();
dp[0][0]=1;
forne(i,MAXN-1) forn(j,i+1)
{
    dp[i][j]=dp[i-1][j+1];
    if(j) dp[i][j]= (dp[i][j]+dp[i-1][j-1])%MOD;
}
ll T;
// cin>>T;
T=1;
while(T--)
{
    ll n,m;
    cin>>n>>m;
    string s;
    cin>>s;
    if(n%2) {cout<<"0\n";continue;}
    ll mn=0,val=0,cm=0;
    forn(i,m) {
        val+=(s[i]=='(')?1:-1;
        cm+=(s[i]=='(');
        mn=min(mn,val);
    }
    if(cm>n/2 || mn>(n/2-cm)) {cout<<"0\n";continue;}
    ll ans=0;
    forn(i,n-m+1)
    {
        forn(j,i+1)
        {
            if(j+mn>=0) ans= (ans+(dp[i][j]*dp[n-m-i][j+val])%MOD)%MOD;
        }
    }
    cout<<ans<<'\n';
}
auto stop = high_resolution_clock::now();
auto duration = duration_cast<microseconds>(stop - start);
// cout << "Time taken by function: "
//          << duration.count() << " microseconds" << endl;
}


#include <bits/stdc++.h>
using namespace std;

const int mod = 1'000'000'007;

void ad(int& x, int y) {
    x += y;
    if (x >= mod)
        x -= mod;
}

map<int, int> dp[2005][2];

int main() {
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    int x=0, y=0;
    for (char c : s) {
        if (c == '(') {
            y++;
        } else {
            y--;
        }
        x = min(x, y);
    }
    // x je min pad, y je ceo balans

    if (n > m) {
        cout << "0\n";
        return 0;
    }

    if (n == m) {
        cout << (y == 0 && x == 0) << '\n';
        return 0;
    }

    dp[0][0][0] = 1;
    for (int i=0; i<n-m; i++) {
        for (int j=0; j<2; j++) {
            for (auto [b, v] : dp[i][j]) {
                // dodaj ceo string
                if (j == 0 && b + x >= 0) {
                    ad(dp[i][j+1][b + y], v);
                }
                // dodaj otvr
                ad(dp[i+1][j][b+1], v);
                // dodaj zatv
                if (b-1 >= 0) {
                    ad(dp[i+1][j][b-1], v);
                }
            }
        }
    }
    cout << dp[n-m][1][0] << '\n';
}


#include <bits/stdc++.h>
using namespace std;

const int mod = 1'000'000'007;

void ad(int& x, int y) {
    x += y;
    if (x >= mod)
        x -= mod;
}

map<int, int> dp[2005][2];

int main() {
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    int x=0, y=0;
    for (char c : s) {
        if (c == '(') {
            y++;
        } else {
            y--;
        }
        x = min(x, y);
    }
    // x je min pad, y je ceo balans

    if (n == m) {
        cout << (y == 0 && x == 0) << '\n';
        return 0;
    }

    dp[0][0][0] = 1;
    for (int i=0; i<=n-m; i++) {
        for (int j=0; j<2; j++) {
            for (auto [b, v] : dp[i][j]) {
                // dodaj ceo string
                if (j == 0 && b + x >= 0) {
                    ad(dp[i][j+1][b + y], v);
                }
                // dodaj otvr
                ad(dp[i+1][j][b+1], v);
                // dodaj zatv
                if (b-1 >= 0) {
                    ad(dp[i+1][j][b-1], v);
                }
            }
        }
    }
    cout << dp[n-m][1][0] << '\n';
}


#include <bits/stdc++.h>
using namespace std;

const int mod = 1'000'000'007;

void ad(int& x, int y) {
    x += y;
    if (x >= mod)
        x -= mod;
}

map<int, int> dp[2005][2];

int main() {
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    int x=0, y=0;
    for (char c : s) {
        if (c == '(') {
            y++;
        } else {
            y--;
        }
        x = min(x, y);
    }
    // x je min pad, y je ceo balans

    if (n == m) {
        cout << (y == 0 && x == 0) << '\n';
        return 0;
    }

    dp[0][0][0] = 1;
    for (int i=0; i<n-m; i++) {
        for (int j=0; j<2; j++) {
            for (auto [b, v] : dp[i][j]) {
                // dodaj ceo string
                if (j == 0 && b + x >= 0) {
                    ad(dp[i+1][j+1][b + y], v);
                }
                // dodaj otvr
                ad(dp[i+1][j][b+1], v);
                // dodaj zatv
                if (b-1 >= 0) {
                    ad(dp[i+1][j][b-1], v);
                }
            }
        }
    }
    cout << dp[n-m][1][0] << '\n';
}


#include <bits/stdc++.h>
using namespace std;

const int mod = 1'000'000'007;

void ad(int& x, int y) {
    x += y;
    if (x >= mod)
        x -= mod;
}

map<int, int> dp[2005][2];

int main() {
    int n, m;
    cin >> n >> m;
    string s;
    cin >> s;
    int x=0, y=0;
    for (char c : s) {
        if (c == '(') {
            y++;
        } else {
            y--;
        }
        x = min(x, y);
    }
    // x je min pad, y je ceo balans

    if (n == m) {
        cout << (y == 0 && x == 0) << '\n';
        return 0;
    }

    dp[0][0][0] = 1;
    for (int i=0; i<n-m; i++) {
        for (int j=0; j<2; j++) {
            for (auto [b, v] : dp[i][j]) {
                // dodaj ceo string
                if (j == 0 && b + x >= 0) {
                    ad(dp[i][j+1][b + y], v);
                }
                // dodaj otvr
                ad(dp[i+1][j][b+1], v);
                // dodaj zatv
                if (b-1 >= 0) {
                    ad(dp[i+1][j][b-1], v);
                }
            }
        }
    }
    cout << dp[n-m][1][0] << '\n';
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int add(int a, int b) {

	int res = a + b;

	if (res > 1e9 + 7) {

		res -= 1e9 + 7;
	}

	return res;
}

int main() {

	int n, m;
	cin >> n >> m;

	string s;
	cin >> s;

	int open_b = 0, closed_b = 0,
		min_open_b = 0, min_closed_b = 0;

	for (int i = 0; i < s.size(); ++i) {

		if (s[i] == ')') {

			++open_b;

			min_open_b = max(min_open_b, open_b);
		}
		else {

			--open_b;
		}

		if (s[s.size() - i - 1] == '(') {

			++closed_b;

			min_closed_b = max(min_closed_b, closed_b);
		}
		else {

			--closed_b;
		}
	}

	vector<vector<uint16_t>> dp(n + 1, vector<uint16_t>(n + 1));

	dp[0][0] = 1;
	for (int i = 1; i <= n; ++i) {

		for (int j = 0; j <= i; ++j) {

			if (j < i) {

				dp[i][j] = add(dp[i][j], dp[i - 1][j + 1]);
			}

			if (j > 0) {

				dp[i][j] = add(dp[i][j],dp[i - 1][j - 1]);
			}

		}
	}

	int res = 0;
	for (int i = 0; i <= n - m; ++i) {

		for (int j = min_closed_b; j <= n && min_open_b + (j - min_closed_b) <= n; ++j) {

			res = add(res, (dp[i][j] * 1LL * dp[n - m - i][min_open_b + (j - min_closed_b)]) % ((int)1e9 + 7));
		}
	}

	cout << res;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int add(int a, int b) {

	long long res = a + b;

	if (res > 1e9 + 7) {

		res -= 1e9 + 7;
	}

	return res;
}

int main() {

	int n, m;
	cin >> n >> m;

	string s;
	cin >> s;

	int open_b = 0, closed_b = 0,
		min_open_b = 0, min_closed_b = 0;

	for (int i = 0; i < s.size(); ++i) {

		if (s[i] == ')') {

			++open_b;

			min_open_b = max(min_open_b, open_b);
		}
		else {

			--open_b;
		}

		if (s[s.size() - i - 1] == '(') {

			++closed_b;

			min_closed_b = max(min_closed_b, closed_b);
		}
		else {

			--closed_b;
		}
	}

	vector<vector<int>> dp(n + 1, vector<int>(n + 1));

	dp[0][0] = 1;
	for (int i = 1; i <= n; ++i) {

		for (int j = 0; j <= i; ++j) {

			if (j < i) {

				dp[i][j] = add(dp[i][j], dp[i - 1][j + 1]);
			}

			if (j > 0) {

				dp[i][j] = add(dp[i][j],dp[i - 1][j - 1]);
			}

		}
	}

	int res = 0;
	for (int i = 0; i <= n - m; ++i) {

		for (int j = min_closed_b; j <= n && min_open_b + (j - min_closed_b) <= n; ++j) {

			res = add(res, (dp[i][j] * 1LL * dp[n - m - i][min_open_b + (j - min_closed_b)]) % ((int)1e9 + 7));
		}
	}

	cout << res;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int add(int a, int b) {

	int res = a + b;

	if (res > 1e9 + 7) {

		res -= 1e9 + 7;
	}

	return res;
}

int main() {

	int n, m;
	cin >> n >> m;

	string s;
	cin >> s;

	int open_b = 0, closed_b = 0,
		min_open_b = 0, min_closed_b = 0;

	for (int i = 0; i < s.size(); ++i) {

		if (s[i] == ')') {

			++open_b;

			min_open_b = max(min_open_b, open_b);
		}
		else {

			--open_b;
		}

		if (s[s.size() - i - 1] == '(') {

			++closed_b;

			min_closed_b = max(min_closed_b, closed_b);
		}
		else {

			--closed_b;
		}
	}

	vector<vector<int>> dp(2001, vector<int>(2001));

	dp[0][0] = 1;
	for (int i = 1; i <= 2000; ++i) {

		for (int j = 0; j <= i; ++j) {

			if (j < i) {

				dp[i][j] = add(dp[i][j], dp[i - 1][j + 1]);
			}

			if (j > 0) {

				dp[i][j] = add(dp[i][j], dp[i - 1][j - 1]);
			}

		}
	}

	int res = 0;
	for (int i = 0; i <= n - m; ++i) {

		for (int j = min_closed_b; j <= n && min_open_b + (j - min_closed_b) <= n; ++j) {

			res = add(res, (dp[i][j] * 1LL * dp[n - m - i][min_open_b + (j - min_closed_b)]) % ((int)1e9 + 7));
		}
	}

	cout << res;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int add(int a, int b) {

	int res = a + b;

	if (res > 1e9 + 7) {

		res -= 1e9 + 7;
	}

	return res;
}

int main() {

	int n, m;
	cin >> n >> m;

	string s;
	cin >> s;

	int open_b = 0, closed_b = 0,
		min_open_b = 0, min_closed_b = 0;

	for (int i = 0; i < s.size(); ++i) {

		if (s[i] == ')') {

			++open_b;

			min_open_b = max(min_open_b, open_b);
		}
		else {

			--open_b;
		}

		if (s[s.size() - i - 1] == '(') {

			++closed_b;

			min_closed_b = max(min_closed_b, closed_b);
		}
		else {

			--closed_b;
		}
	}

	vector<vector<int>> dp(2001, vector<int>(2001));

	dp[0][0] = 1;
	for (int i = 1; i <= 2000; ++i) {

		for (int j = 0; j <= i; ++j) {

			if (j < i) {

				dp[i][j] = add(dp[i][j], dp[i - 1][j + 1]);
			}

			if (j > 0) {

				dp[i][j] = add(dp[i][j], dp[i - 1][j - 1]);
			}

		}
	}

	int res = 0;
	for (int i = 0; i <= n - m; ++i) {

		for (int j = min_closed_b; j <= 2000 && min_open_b + (j - min_closed_b) <= 2000; ++j) {

			res = add(res, (dp[i][j] * 1LL * dp[n - m - i][min_open_b + (j - min_closed_b)]) % ((int)1e9 + 7));
		}
	}

	cout << res;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int add(int a, int b) {

	int res = a + b;

	if (res > 1e9 + 7) {

		res -= 1e9 + 7;
	}

	return res;
}

int main() {

	int n, m;
	cin >> n >> m;

	string s;
	cin >> s;

	int open_b = 0, closed_b = 0,
		min_open_b = 0, min_closed_b = 0;

	for (int i = 0; i < s.size(); ++i) {

		if (s[i] == ')') {

			++open_b;

			min_open_b = max(min_open_b, open_b);
		}
		else {

			--open_b;
		}

		if (s[s.size() - i - 1] == '(') {

			++closed_b;

			min_closed_b = max(min_closed_b, closed_b);
		}
		else {

			--closed_b;
		}
	}

	vector<vector<uint32_t>> dp(n + 1, vector<uint32_t>(n + 1));

	dp[0][0] = 1;
	for (int i = 1; i <= n; ++i) {

		for (int j = 0; j <= i; ++j) {

			if (j < i) {

				dp[i][j] = add(dp[i][j], dp[i - 1][j + 1]);
			}

			if (j > 0) {

				dp[i][j] = add(dp[i][j],dp[i - 1][j - 1]);
			}

		}
	}

	int res = 0;
	for (int i = 0; i <= n - m; ++i) {

		for (int j = min_closed_b; j <= n && min_open_b + (j - min_closed_b) <= n; ++j) {

			res = add(res, (dp[i][j] * 1LL * dp[n - m - i][min_open_b + (j - min_closed_b)]) % ((int)1e9 + 7));
		}
	}

	cout << res;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int add(int a, int b) {

	int res = a + b;

	if (res > 1e9 + 7) {

		res -= 1e9 + 7;
	}

	return res;
}

int main() {

	int n, m;
	cin >> n >> m;

	string s;
	cin >> s;

	int open_b = 0, closed_b = 0,
		min_open_b = 0, min_closed_b = 0;

	for (int i = 0; i < s.size(); ++i) {

		if (s[i] == ')') {

			++open_b;

			min_open_b = max(min_open_b, open_b);
		}
		else {

			--open_b;
		}

		if (s[s.size() - i - 1] == '(') {

			++closed_b;

			min_closed_b = max(min_closed_b, closed_b);
		}
		else {

			--closed_b;
		}
	}

	vector<vector<int16_t>> dp(n + 1, vector<int16_t>(n + 1));

	dp[0][0] = 1;
	for (int i = 1; i <= n; ++i) {

		for (int j = 0; j <= i; ++j) {

			if (j < i) {

				dp[i][j] = add(dp[i][j], dp[i - 1][j + 1]);
			}

			if (j > 0) {

				dp[i][j] = add(dp[i][j],dp[i - 1][j - 1]);
			}

		}
	}

	int res = 0;
	for (int i = 0; i <= n - m; ++i) {

		for (int j = min_closed_b; j <= n && min_open_b + (j - min_closed_b) <= n; ++j) {

			res = add(res, (dp[i][j] * 1LL * dp[n - m - i][min_open_b + (j - min_closed_b)]) % ((int)1e9 + 7));
		}
	}

	cout << res;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int add(int a, int b) {

	int res = a + b;

	if (res > 1e9 + 7) {

		res -= 1e9 + 7;
	}

	return res;
}

int main() {

	int n, m;
	cin >> n >> m;

	string s;
	cin >> s;

	int open_b = 0, closed_b = 0,
		min_open_b = 0, min_closed_b = 0;

	for (int i = 0; i < s.size(); ++i) {

		if (s[i] == ')') {

			++open_b;

			min_open_b = max(min_open_b, open_b);
		}
		else {

			--open_b;
		}

		if (s[s.size() - i - 1] == '(') {

			++closed_b;

			min_closed_b = max(min_closed_b, closed_b);
		}
		else {

			--closed_b;
		}
	}

	vector<vector<uint32_t>> dp(2001, vector<uint32_t>(2001));

	dp[0][0] = 1;
	for (int i = 1; i <= n; ++i) {

		for (int j = 0; j <= i; ++j) {

			if (j < i) {

				dp[i][j] = add(dp[i][j], dp[i - 1][j + 1]);
			}

			if (j > 0) {

				dp[i][j] = add(dp[i][j],dp[i - 1][j - 1]);
			}

		}
	}

	int res = 0;
	for (int i = 0; i <= n - m; ++i) {

		for (int j = min_closed_b; j <= 2000 && min_open_b + (j - min_closed_b) <= 2000; ++j) {

			res = add(res, (dp[i][j] * 1LL * dp[n - m - i][min_open_b + (j - min_closed_b)]) % ((int)1e9 + 7));
		}
	}

	cout << res;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <algorithm>

using namespace std;

int add(int a, int b) {

	int res = a + b;

	if (res > 1e9 + 7) {

		res -= 1e9 + 7;
	}

	return res;
}

int main() {

	int n, m;
	cin >> n >> m;

	string s;
	cin >> s;

	int open_b = 0, closed_b = 0,
		min_open_b = 0, min_closed_b = 0;

	for (int i = 0; i < s.size(); ++i) {

		if (s[i] == ')') {

			++open_b;

			min_open_b = max(min_open_b, open_b);
		}
		else {

			--open_b;
		}

		if (s[s.size() - i - 1] == '(') {

			++closed_b;

			min_closed_b = max(min_closed_b, closed_b);
		}
		else {

			--closed_b;
		}
	}

	vector<vector<uint32_t>> dp(2001, vector<uint32_t>(2001));

	dp[0][0] = 1;
	for (int i = 1; i <= n; ++i) {

		for (int j = 0; j <= i; ++j) {

			if (j < i) {

				dp[i][j] = add(dp[i][j], dp[i - 1][j + 1]);
			}

			if (j > 0) {

				dp[i][j] = add(dp[i][j],dp[i - 1][j - 1]);
			}

		}
	}

	int res = 0;
	for (int i = 0; i <= n - m; ++i) {

		for (int j = min_closed_b; j <= n && min_open_b + (j - min_closed_b) <= n; ++j) {

			res = add(res, (dp[i][j] * 1LL * dp[n - m - i][min_open_b + (j - min_closed_b)]) % ((int)1e9 + 7));
		}
	}

	cout << res;

	return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<string.h>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<sstream>
using namespace std;
#define inf 2147483647//2^31
#define ll 9223372036854775807//2^64'
#define eps 1e-6
	/*ios_base::sync_with_stdio(false);
cin.tie(0);
 cout.tie(0);*/
long long dp[2005][2005]={};
int main()
{

	int a,b;
	while(cin>>a>>b){
		 dp[0][0]=1;
	for(int i=1;i<=a-b;i++){
		for(int j=0;j<=i;j++){
			if(j==0){
			dp[i][j]=dp[i-1][j+1];
			}
			else{
			dp[i][j]=dp[i-1][j+1]+dp[i-1][j-1];
			}
			dp[i][j]%=1000000007;
		}
	}
		string c;
		cin>>c;
		int sum=0;
		int need=inf;
		for(int i=0;i<c.size();i++){
		if(c[i]=='(')
			sum++;
		else
			sum--;
		need=min(need,sum);
		}
		long long ans=0;
		for(int i=0;i<=a-b;i++){
			for(int j=0;j<=i;j++){
				if(j>=-need&&j+sum<=a-b-i){
				ans+=dp[i][j]*dp[a-b-i][sum+j];
				ans%=1000000007;
				}
			}
		}
		cout<<ans<<endl;
	}

return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<string.h>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<sstream>
using namespace std;
#define inf 2147483647//2^31
#define ll 9223372036854775807//2^64'
#define eps 1e-6
	/*ios_base::sync_with_stdio(false);
cin.tie(0);
 cout.tie(0);*/
int dp[2005][2005]={};
int main()
{
	 dp[0][0]=1;
	for(int i=1;i<=2000;i++){
		for(int j=0;j<=i;j++){
			if(j==0){
			dp[i][j]=dp[i-1][j+1];
			}
			else{
			dp[i][j]=dp[i-1][j+1]+dp[i-1][j-1];
			}
			dp[i][j]%=1000000007;
		}
	}
	int a,b;
	while(cin>>a>>b){
		string c;
		cin>>c;
		int sum=0;
		int need=inf;
		for(int i=0;i<c.size();i++){
		if(c[i]=='(')
			sum++;
		else
			sum--;
		need=min(need,sum);
		}
		int ans=0;
		for(int i=0;i<=a-b;i++){
			for(int j=0;j<=i;j++){
				if(j>=-need&&j+sum<=a-b){
				ans+=dp[i][j]*dp[a-b-i][sum+j];
				ans%=1000000007;
				}
			}
		}
		cout<<ans<<endl;
	}

return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<string.h>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<sstream>
using namespace std;
#define inf 2147483647//2^31
#define ll 9223372036854775807//2^64'
#define eps 1e-6
	/*ios_base::sync_with_stdio(false);
cin.tie(0);
 cout.tie(0);*/
int dp[2005][2005]={};
int main()
{

	int a,b;
	while(cin>>a>>b){
		 dp[0][0]=1;
	for(int i=1;i<=a-b;i++){
		for(int j=0;j<=i;j++){
			if(j==0){
			dp[i][j]=dp[i-1][j+1];
			}
			else{
			dp[i][j]=dp[i-1][j+1]+dp[i-1][j-1];
			}
			dp[i][j]%=1000000007;
		}
	}
		string c;
		cin>>c;
		int sum=0;
		int need=inf;
		for(int i=0;i<c.size();i++){
		if(c[i]=='(')
			sum++;
		else
			sum--;
		need=min(need,sum);
		}
		int ans=0;
		for(int i=0;i<=a-b;i++){
			for(int j=0;j<=i;j++){
				if(j>=-need&&j+sum<=a-b){
				ans+=dp[i][j]*dp[a-b-i][sum+j];
				ans%=1000000007;
				}
			}
		}
		cout<<ans<<endl;
	}

return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<string.h>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<sstream>
using namespace std;
#define inf 2147483647//2^31
#define ll 9223372036854775807//2^64'
#define eps 1e-6
	/*ios_base::sync_with_stdio(false);
cin.tie(0);
 cout.tie(0);*/
int dp[2005][2005]={};
int main()
{

	int a,b;
	while(cin>>a>>b){
		 dp[0][0]=1;
	for(int i=1;i<=a-b;i++){
		for(int j=0;j<=i;j++){
			if(j==0){
			dp[i][j]=dp[i-1][j+1];
			}
			else{
			dp[i][j]=dp[i-1][j+1]+dp[i-1][j-1];
			}
			dp[i][j]%=1000000007;
		}
	}
		string c;
		cin>>c;
		int sum=0;
		int need=inf;
		for(int i=0;i<c.size();i++){
		if(c[i]=='(')
			sum++;
		else
			sum--;
		need=min(need,sum);
		}
		int ans=0;
		for(int i=0;i<=a-b;i++){
			for(int j=0;j<=i;j++){
				if(j>=-need&&j+sum<=a-b-i){
				ans+=dp[i][j]%1000000007*dp[a-b-i][sum+j]%1000000007;
				ans%=1000000007;
				}
			}
		}
		cout<<ans<<endl;
	}

return 0;
}


#include<iostream>
#include<string>
#include<algorithm>
#include<cmath>
#include<string.h>
#include<vector>
#include<stack>
#include<queue>
#include<map>
#include<set>
#include<cstring>
#include<cstdlib>
#include<cstdio>
#include<sstream>
using namespace std;
#define inf 2147483647//2^31
#define ll 9223372036854775807//2^64'
#define eps 1e-6
	/*ios_base::sync_with_stdio(false);
cin.tie(0);
 cout.tie(0);*/
int dp[2005][2005]={};
int main()
{

	int a,b;
	while(cin>>a>>b){
		 dp[0][0]=1;
	for(int i=1;i<=a-b;i++){
		for(int j=0;j<=i;j++){
			if(j==0){
			dp[i][j]=dp[i-1][j+1];
			}
			else{
			dp[i][j]=dp[i-1][j+1]+dp[i-1][j-1];
			}
			dp[i][j]%=1000000007;
		}
	}
		string c;
		cin>>c;
		int sum=0;
		int need=inf;
		for(int i=0;i<c.size();i++){
		if(c[i]=='(')
			sum++;
		else
			sum--;
		need=min(need,sum);
		}
		int ans=0;
		for(int i=0;i<=a-b;i++){
			for(int j=0;j<=i;j++){
				if(j>=-need&&j+sum<=a-b-i){
				ans+=dp[i][j]*dp[a-b-i][sum+j];
				ans%=1000000007;
				}
			}
		}
		cout<<ans<<endl;
	}

return 0;
}


#include <iostream>
#include <iomanip>
#include <cmath>
#include <set>
#include <string>
#include <map>
#include <utility>
#include <queue>
#include <algorithm>
#include <stack>
#include <cstdlib>
#include <ctime>
using namespace std;

int dp[2010][2010];
int MOD = 1000000007;
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int n, m,b=0,l=0;
	cin>>n>>m;
	for (int i=0; i<m; i++)
	{
		char c;
		cin>>c;
		if (c==')')
		{
			b--;
			if (b<l)
				l=b;
		}
		else
			b++;
	}
	dp[0][0]=1;
	for (int i=1; i<2001; ++i)
		for (int j =0; j < 2001; ++j)
		{
			if (j==0)
				dp[i][j]=dp[i-1][j+1];
			else
			dp[i][j]=(dp[i-1][j+1]+dp[i-1][j-1])%MOD;
		}
		int ans1=0, ans2=0, ans=0;
		for (int i=0; i<=n-m; ++i)
		{
			for (int j=0; j <=i; j++)
			{
				if (j+l>=0)
				{
					ans1=dp[i][j];
					ans2=dp[n-m-i][j+b];
					ans=(ans+ans1*1ll*ans2)%MOD;
				}
			}
		}
		cout<<ans;
return 0;
}


#include <iostream>
#include <iomanip>
#include <cmath>
#include <set>
#include <string>
#include <map>
#include <utility>
#include <queue>
#include <algorithm>
#include <stack>
#include <cstdlib>
#include <ctime>
using namespace std;

int dp[2010][2010];
int MOD = 1000000007;
int main()
{
	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);
	int n, m,b=0,l=0;
	cin>>n>>m;
	for (int i=0; i<m; i++)
	{
		char c;
		cin>>c;
		if (c==')')
		{
			b--;
			if (b<l)
				l=b;
		}
		else
			b++;
	}
	dp[0][0]=1;
	for (int i=1; i<2001; ++i)
		for (int j =0; j < 2001; ++j)
		{
			if (j==0)
				dp[i][j]=dp[i-1][j+1];
			else
			dp[i][j]=(dp[i-1][j+1]+dp[i-1][j-1])%MOD;
		}
		int ans1=0, ans2=0, ans=0;
		for (int i=0; i<=n-m; ++i)
		{
			for (int j=0; j <=i; j++)
			{
				if (j+l>=0)
				{
					if (n-m-i>=j+b)
					{
					ans1=dp[i][j];
					ans2=dp[n-m-i][j+b];
					ans=(ans+ans1*1ll*ans2)%MOD;
					}
				}
			}
		}
		cout<<ans;
return 0;
}


#include <iostream>
#include <iomanip>
#include <cmath>
#include <set>
#include <string>
#include <map>
#include <utility>
#include <queue>
#include <algorithm>
#include <stack>
#include <cstdlib>
#include <ctime>
using namespace std;

int dp[2010][2010];
int MOD = 1000000007;
int main()
{
	freopen("in.txt","r",stdin);
	freopen("out.txt","w",stdout);
	int n, m,b=0,l=0;
	cin>>n>>m;
	for (int i=0; i<m; i++)
	{
		char c;
		cin>>c;
		if (c==')')
		{
			b--;
			if (b<l)
				l=b;
		}
		else
			b++;
	}
	dp[0][0]=1;
	for (int i=1; i<2001; ++i)
		for (int j =0; j < 2001; ++j)
		{
			if (j==0)
				dp[i][j]=dp[i-1][j+1];
			else
			dp[i][j]=(dp[i-1][j+1]+dp[i-1][j-1])%MOD;
		}
		int ans1=0, ans2=0, ans=0;
		for (int i=0; i<=n-m; ++i)
		{
			for (int j=0; j <=i; j++)
			{
				if (j+l>=0)
				{
					ans1=dp[i][j];
					ans2=dp[n-m-i][j+b];
					ans=(ans+ans1*1ll*ans2)%MOD;
				}
			}
		}
		cout<<ans;
return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <utility>
#include <stack>
#include <climits>
#include <deque>
#define MAXN 100005
#define MAXM 1000000005
#define MAXLG 18
#define endl '\n'
const double PI = 3.1415926535897932384626433832795;
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
int O[MAXN],C[MAXN]; ll L[2005][2005];
int main() {
	//freopen("input.txt", "r", stdin);//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.precision(12);
	cout << fixed;
	int n,m,mn=0,x;string s;
	cin>>n>>m;
	cin>>s;
	for(int i = 1; i <= s.size(); ++i){
		O[i]=O[i-1];
		C[i]=C[i-1];
		if(s[i-1]=='(')++O[i];
		else ++C[i];
		if(C[i]>O[i]) mn = max(mn,C[i]-O[i]);
	}
	L[0][0]=1,L[1][1]=1;
	for(int len = 2; len <= 2000; ++len){
		for(int k = 0; k <= len; ++k){
			L[len][k]+=L[len-1][k+1];
			if(k>0) L[len][k]=(L[len][k]+L[len-1][k-1])%mod;
		}
	}
	x = O[m]-C[m];
	ll ans = 0;int diff=n-m;
	for(int i = mn; i <= diff; ++i){
		for(int j = mn; j <= i; ++j){
			if(x+j>=0) ans= (ans+(L[i][j]*L[diff-i][x+j])%mod)%mod;
		}
	}
	if(m==n){
		if(n%2==0&&mn==0&&x==0) cout << 1 << endl;
		else cout << 0 << endl;
	}
	else cout<<ans<<endl;

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <utility>
#include <stack>
#include <climits>
#include <deque>
#define MAXN 100005
#define MAXM 1000000005
#define MAXLG 18
#define endl '\n'
const double PI = 3.1415926535897932384626433832795;
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
ll O[MAXN],C[MAXN], L[2005][2005];
int main() {
	//freopen("input.txt", "r", stdin);//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.precision(12);
	cout << fixed;
	int n,m,mn=0,x;string s;
	cin>>n>>m;
	cin>>s;
	for(int i = 1; i <= s.size(); ++i){
		O[i]=O[i-1];
		C[i]=C[i-1];
		if(s[i-1]=='(')++O[i];
		else ++C[i];
		if(C[i]>O[i]) mn = max(mn,C[i]-O[i]);
	}
	L[0][0]=1,L[1][1]=1;
	for(int len = 2; len <= 2000; ++len){
		for(int k = 0; k <= len; ++k){
			L[len][k]+=L[len-1][k+1];
			if(k>0) L[len][k]=(L[len][k]+L[len-1][k-1])%mod;
		}
	}
	x = O[m]-C[m];
	int ans = 0, diff=n-m;
	for(int i = mn; i <= diff; ++i){
		for(int j = mn; j <= i; ++j){
			if(x+j>=0) ans= (ans+(L[i][j]*L[diff-i][x+j])%mod)%mod;
		}
	}
	if(m==n){
		if(n%2==0&&mn==0&&x==0) cout << 1 << endl;
		else cout << 0 << endl;
	}
	else cout<<ans<<endl;

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <utility>
#include <stack>
#include <climits>
#include <deque>
#define MAXN 100005
#define MAXM 1000000005
#define MAXLG 18
#define endl '\n'
const double PI = 3.1415926535897932384626433832795;
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
int O[MAXN],C[MAXN], L[2005][2005];
int main() {
	//freopen("input.txt", "r", stdin);//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.precision(12);
	cout << fixed;
	int n,m,mn=0,x;string s;
	cin>>n>>m;
	cin>>s;
	for(int i = 1; i <= s.size(); ++i){
		O[i]=O[i-1];
		C[i]=C[i-1];
		if(s[i-1]=='(')++O[i];
		else ++C[i];
		if(C[i]>O[i]) mn = max(mn,C[i]-O[i]);
	}
	L[0][0]=1,L[1][1]=1;
	for(int len = 2; len <= 2000; ++len){
		for(int k = 0; k <= len; ++k){
			L[len][k]+=L[len-1][k+1];
			if(k>0) L[len][k]=(L[len][k]+L[len-1][k-1])%mod;
		}
	}
	x = O[m]-C[m];
	int ans = 0, diff=n-m;
	for(int i = mn; i <= diff; ++i){
		for(int j = mn; j <= i; ++j){
			if(x+j>=0) ans= (ans+(L[i][j]*L[diff-i][x+j])%mod)%mod;
		}
	}
	if(m==n){
		if(n%2==0&&mn==0&&x==0) cout << 1 << endl;
		else cout << 0 << endl;
	}
	else cout<<ans<<endl;

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <utility>
#include <stack>
#include <climits>
#include <deque>
#define MAXN 100005
#define MAXM 1000000005
#define MAXLG 18
#define endl '\n'
const double PI = 3.1415926535897932384626433832795;
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
int O[MAXN],C[MAXN], L[2005][2005];
int main() {
	//freopen("input.txt", "r", stdin);//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.precision(12);
	cout << fixed;
	int n,m,mn=0,x;string s;
	cin>>n>>m;
	cin>>s;
	for(int i = 1; i <= s.size(); ++i){
		O[i]=O[i-1];
		C[i]=C[i-1];
		if(s[i-1]=='(')++O[i];
		else ++C[i];
		if(C[i]>O[i]) mn = max(mn,C[i]-O[i]);
	}
	L[0][0]=1,L[1][1]=1;
	for(int len = 2; len <= 2000; ++len){
		for(int k = 0; k <= len; ++k){
			L[len][k]+=L[len-1][k+1];
			if(k>0) L[len][k]+=L[len-1][k-1];
		}
	}
	x = O[m]-C[m];
	int ans = 0, diff=n-m;
	for(int i = mn; i <= diff; ++i){
		for(int j = mn; j <= i; ++j){
			if(x+j>0) ans += L[i][j]*L[diff-i][x+j];
		}
	}
	if(m==n){
		if(n%2==0&&mn==0&&x==0) cout << 1 << endl;
		else cout << 0 << endl;
	}
	else cout<<ans<<endl;

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <utility>
#include <stack>
#include <climits>
#include <deque>
#define MAXN 100005
#define MAXM 1000000005
#define MAXLG 18
#define endl '\n'
const double PI = 3.1415926535897932384626433832795;
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
int O[MAXN],C[MAXN], L[2005][2005];
int main() {
	//freopen("input.txt", "r", stdin);//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.precision(12);
	cout << fixed;
	int n,m,mn=0,x;string s;
	cin>>n>>m;
	cin>>s;
	for(int i = 1; i <= s.size(); ++i){
		O[i]=O[i-1];
		C[i]=C[i-1];
		if(s[i-1]=='(')++O[i];
		else ++C[i];
		if(C[i]>O[i]) mn = max(mn,C[i]-O[i]);
	}
	L[0][0]=1,L[1][1]=1;
	for(int len = 2; len <= 2000; ++len){
		for(int k = 0; k <= len; ++k){
			L[len][k]+=L[len-1][k+1];
			if(k>0) L[len][k]+=L[len-1][k-1];
		}
	}
	x = O[m]-C[m];
	int ans = 0, diff=n-m;
	for(int i = mn; i <= diff; ++i){
		for(int j = mn; j <= i; ++j){
			if(x+j>=0) ans += L[i][j]*L[diff-i][x+j];
		}
	}
	if(m==n){
		if(n%2==0&&mn==0&&x==0) cout << 1 << endl;
		else cout << 0 << endl;
	}
	else cout<<ans<<endl;

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <utility>
#include <stack>
#include <climits>
#include <deque>
#define MAXN 100005
#define MAXM 1000000005
#define MAXLG 18
#define endl '\n'
const double PI = 3.1415926535897932384626433832795;
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
int O[MAXN],C[MAXN]; ll L[2005][2005];
int main() {
	//freopen("input.txt", "r", stdin);//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.precision(12);
	cout << fixed;
	int n,m,mn=0,x;string s(98000,'(');
	cin>>n>>m;
	//cin>>s;
	for(int i = 1; i <= s.size(); ++i){
		O[i]=O[i-1];
		C[i]=C[i-1];
		if(s[i-1]=='(')++O[i];
		else ++C[i];
		if(C[i]>O[i]) mn = max(mn,C[i]-O[i]);
	}
	L[0][0]=1,L[1][1]=1;
	for(int len = 2; len <= 2000; ++len){
		for(int k = 0; k <= len; ++k){
			L[len][k]+=L[len-1][k+1];
			if(k>0) L[len][k]=(L[len][k]+L[len-1][k-1])%mod;
		}
	}
	x = O[m]-C[m];
	ll ans = 0;int diff=n-m;
	for(int i = mn; i <= diff; ++i){
		for(int j = mn; j <= i; ++j){
			if(x+j<=diff-i) ans= (ans+(L[i][j]*L[diff-i][x+j])%mod)%mod;
		}
	}
	if(m==n){
		if(n%2==0&&mn==0&&x==0) cout << 1 << endl;
		else cout << 0 << endl;
	}
	else cout<<ans<<endl;

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <utility>
#include <stack>
#include <climits>
#include <deque>
#define MAXN 100005
#define MAXM 1000000005
#define MAXLG 18
#define endl '\n'
const double PI = 3.1415926535897932384626433832795;
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
int O[MAXN],C[MAXN]; ll L[2005][2005];
int main() {
	//freopen("input.txt", "r", stdin);//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.precision(12);
	cout << fixed;
	int n,m,mn=0,x;string s;
	cin>>n>>m;
	cin>>s;
	for(int i = 1; i <= s.size(); ++i){
		O[i]=O[i-1];
		C[i]=C[i-1];
		if(s[i-1]=='(')++O[i];
		else ++C[i];
		if(C[i]>O[i]) mn = max(mn,C[i]-O[i]);
	}
	L[0][0]=1,L[1][1]=1;
	for(int len = 2; len <= 2000; ++len){
		for(int k = 0; k <= len; ++k){
			L[len][k]+=L[len-1][k+1];
			if(k>0) L[len][k]=(L[len][k]+L[len-1][k-1])%mod;
		}
	}
	x = O[m]-C[m];
	ll ans = 0;int diff=n-m;
	for(int i = mn; i <= diff; ++i){
		for(int j = mn; j <= i; ++j){
			if(x+j<=diff-i) ans= (ans+(L[i][j]*L[diff-i][x+j])%mod)%mod;
		}
	}
	if(m==n){
		if(n%2==0&&mn==0&&x==0) cout << 1 << endl;
		else cout << 0 << endl;
	}
	else cout<<ans<<endl;

	return 0;
}


#include <cstdio>
#include <iostream>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstring>
#include <string>
#include <set>
#include <queue>
#include <utility>
#include <stack>
#include <climits>
#include <deque>
#define MAXN 100005
#define MAXM 1000000005
#define MAXLG 18
#define endl '\n'
const double PI = 3.1415926535897932384626433832795;
using namespace std;
typedef long long ll;
ll mod = 1e9 + 7;
int O[MAXN],C[MAXN], L[2005][2005];
int main() {
	//freopen("input.txt", "r", stdin);//freopen("output.txt","w",stdout);
	ios::sync_with_stdio(false); cin.tie(nullptr); cout.precision(12);
	cout << fixed;
	int n,m,mn=0,x;string s;
	cin>>n>>m;
	cin>>s;
	for(int i = 1; i <= s.size(); ++i){
		O[i]=O[i-1];
		C[i]=C[i-1];
		if(s[i-1]=='(')++O[i];
		else ++C[i];
		if(C[i]>O[i]) mn = max(mn,C[i]-O[i]);
	}
	L[0][0]=1,L[1][1]=1;
	for(int len = 2; len <= 2000; ++len){
		for(int k = 0; k <= len; ++k){
			L[len][k]+=L[len-1][k+1];
			if(k>0) L[len][k]+=L[len-1][k-1];
		}
	}
	if(C[m]>O[m]){cout<<0<<endl; return 0;}
	x = O[m]-C[m];
	int ans = 0, diff=n-m;
	for(int i = mn; i <= diff; ++i){
		for(int j = mn; j <= i; ++j){
			ans += L[i][j]*L[diff-i][j+x-mn];
		}
	}
	if(m==n){
		if(n%2==0&&x==0) cout << 1 << endl;
		else cout << 0 << endl;
	}
	else cout<<ans<<endl;

	return 0;
}


#pragma comment(linker,"/STACK:268435456")
#include <iostream>
#include <iomanip>
#include <fstream>
#include <set>
#include <algorithm>
#include <vector>
#include <map>
#include <list>
#include <queue>
#include <stack>
#include <cmath>
#include <climits>
#include <cstring>
#include <string>
#include <sstream>
#include <bitset>
#include <iterator>
#include <list>
#include <ctime>
#include <functional>
#include <numeric>
#include <cassert>

#define FR(i,n) for(int (i)=0;(i)<(n);(i)++)
#define FOR(i,c,n) for(int (i)=(c);(i)<(n);(i)++)
#define REP(it,v,cont) for((cont)::iterator (it)=(v).begin();(it)!=(v).end();++(it))
#define CLR(a,c) memset((a),(c),sizeof (a))
#define ALL(v) (v).begin(),(v).end()
#define VCPRINT(v) for(int iii = 0;iii < (v).size();iii++) cout<<(v)[iii]<<" ";cout<<endl;
#define SETPRINT(v,cont) for((cont)::iterator iiit = (v).begin();iiit != (v).end();iiit++) cout<<*iiit<<" ";cout<<endl;

bool ascending (int i,int j) { return (i<j); }
bool descending (int i,int j) { return (i>j); }

typedef long long ll;
typedef unsigned long long ull;
#define PII pair<int,int>
#define PLL pair<long long,long long>
#define PULI pair<unsigned long long,int>
#define PIL pair<int,long long>
#define PSI pair<string,int>
#define PSS pair<string,string>
#define PDD pair<double,double>
#define PIB pair<int,bool>
typedef long double ld;
#define PLI pair<ll,int>

using namespace std;

const int MAXN = 2100;

const int PIV = 2010;
ll dpg[2*MAXN][MAXN];
ll dpf[MAXN][MAXN];
ll MOD = 1000*1000*1000+7;
int n,m;
int X=0,Y=0;
int MIN = 0;

ll g(int cnt,int w)
{
	if(abs(cnt) > w) return 0;
	if(cnt < 0) return 0;
	if(w==0) return (cnt==0);
	if(dpg[PIV+cnt][w]!=-1) return dpg[PIV+cnt][w];

	return dpg[PIV+cnt][w] = ((g(cnt+1,w-1)%MOD) + (g(cnt-1,w-1)%MOD))%MOD;
}

ll f(int x,int y)
{
	if(y > x) return 0;
	if(x+y+m==n) return (x+X==y+Y && (x-y)+MIN==0);
	if(dpf[x][y]!=-1) return dpf[x][y];

	ll ans = 0;

	if((x-y)+MIN >= 0) ans += g((x-y)+(X-Y),n-(x+m+y));
	ans %= MOD;

	ans += f(x+1,y);
	ans %= MOD;

	ans += f(x,y+1);
	ans %= MOD;

	return dpf[x][y]=ans;
}

int main()
{
	CLR(dpf,255);
	CLR(dpg,255);
	cin>>n>>m;
	string s;
	cin>>s;
	int cnt = 0;
	FR(i,s.size())
	{
		X += (s[i]=='(');
		Y += (s[i]==')');
		cnt += (s[i]=='('?1:-1);
		MIN = min(MIN,cnt);
	}

	cout<<f(0,0)<<endl;

}


#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second

using namespace std;

const int maxn = 200000, mod = trunc(1e9+7);
int Pow[maxn+1], n, last, d, k;
typedef pair <int, int> ii;
ii A[2*maxn+1];
ll res;

int POW(int a, int i)
{
    if (i == 1) return a;
    int tmp = POW(a, i/2);
    tmp = 1LL * tmp * tmp % mod;
    if (i & 1) tmp = 1LL * tmp * a % mod;
    return tmp;
}

int c(int i, int j)
{
    if (i > j) return 0;
    return 1LL * Pow[j] * (POW(Pow[i], mod - 2) % mod * (POW(Pow[j-i], mod - 2))) % mod;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cin >> n >> k;
    for (int i=1; i<=n; i++)
    {
        int l, r;
        cin >> l >> r;
        A[i].fi = l-1;
        A[i].se = 1;
        A[n+i].fi = r;
        A[n+i].se = -1;
    }
    Pow[0] = 1;
    for (int i=1; i<=n; i++) Pow[i] = 1LL * Pow[i-1] * i % mod;
    sort(A+1, A+2*n+1);
    for (int i=1; i<=2*n; i++)
    {
        res = (res + 1LL * c(k, d) * (A[i].fi - last) % mod) % mod;
        d += A[i].se;
        last = A[i].fi;
    }
    cout << res;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second

using namespace std;

const int maxn = 200000, mod = trunc(1e9+7);
int Pow[maxn+1], n, last, d, k;
typedef pair <int, int> ii;
ii A[2*maxn+1];
ll res;

int POW(int a, int i)
{
    if (!i) return 1;
    if (i == 1) return a;
    int tmp = POW(a, i/2);
    tmp = 1LL * tmp * tmp % mod;
    if (i & 1) tmp = 1LL * tmp * a % mod;
    return tmp;
}

int c(int i, int j)
{
    if (i > j || i < 0) return 0;
    return 1LL * Pow[j] * (POW(Pow[i], mod - 2) % mod * (POW(Pow[j-i], mod - 2))) % mod;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cin >> n >> k;
    for (int i=1; i<=n; i++)
    {
        int l, r;
        cin >> l >> r;
        A[i].fi = l-1;
        A[i].se = 1;
        A[n+i].fi = r;
        A[n+i].se = -1;
    }
    Pow[0] = 1;
    for (int i=1; i<=n; i++) Pow[i] = 1LL * Pow[i-1] * i % mod;
    sort(A+1, A+2*n+1);
    for (int i=1; i<=2*n; i++)
    {
        res = (res + 1LL * c(k, d) * (A[i].fi - last) % mod) % mod;
        d += A[i].se;
        last = A[i].fi;
    }
    cout << res;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second

using namespace std;

const int maxn = 200000, mod = trunc(1e9+7);
int Pow[maxn+1], n, last, d, k;
typedef pair <int, int> ii;
ii A[2*maxn+1];
ll res;

int POW(int a, int i)
{
    if (!i) return 1;
    if (i == 1) return a;
    int tmp = POW(a, i/2);
    tmp = 1LL * tmp * tmp % mod;
    if (i & 1) tmp = 1LL * tmp * a % mod;
    return tmp;
}

int c(int i, int j)
{
    if (i > j) return 0;
    return 1LL * Pow[j] * (POW(Pow[i], mod - 2) % mod * (POW(Pow[j-i], mod - 2))) % mod;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cin >> n >> k;
    for (int i=1; i<=n; i++)
    {
        int l, r;
        cin >> l >> r;
        A[i].fi = l-1;
        A[i].se = 1;
        A[n+i].fi = r;
        A[n+i].se = -1;
    }
    Pow[0] = 1;
    for (int i=1; i<=n; i++) Pow[i] = 1LL * Pow[i-1] * i % mod;
    sort(A+1, A+2*n+1);
    for (int i=1; i<=2*n; i++)
    {
        res = (res + 1LL * c(k, d) * (A[i].fi - last) % mod) % mod;
        d += A[i].se;
        last = A[i].fi;
    }
    cout << res;
    return 0;
}


#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second

using namespace std;

const int maxn = 200000, mod = trunc(1e9+7);
int Pow[maxn+1], n, last, d, k;
typedef pair <int, int> ii;
ii A[2*maxn+1];
ll res;

int POW(int a, int i)
{
    if (!i) return 0;
    if (i == 1) return a;
    int tmp = POW(a, i/2);
    tmp = 1LL * tmp * tmp % mod;
    if (i & 1) tmp = 1LL * tmp * a % mod;
    return tmp;
}

int c(int i, int j)
{
    if (i > j) return 0;
    return 1LL * Pow[j] * (POW(Pow[i], mod - 2) % mod * (POW(Pow[j-i], mod - 2))) % mod;
}

int main()
{
    ios::sync_with_stdio(0);
    cin.tie(NULL);
    cin >> n >> k;
    for (int i=1; i<=n; i++)
    {
        int l, r;
        cin >> l >> r;
        A[i].fi = l-1;
        A[i].se = 1;
        A[n+i].fi = r;
        A[n+i].se = -1;
    }
    Pow[0] = 1;
    for (int i=1; i<=n; i++) Pow[i] = 1LL * Pow[i-1] * i % mod;
    sort(A+1, A+2*n+1);
    for (int i=1; i<=2*n; i++)
    {
        res = (res + 1LL * c(k, d) * (A[i].fi - last) % mod) % mod;
        d += A[i].se;
        last = A[i].fi;
    }
    cout << res;
    return 0;
}