Consider a circle whose perimeter is divided by N points into N arcs of equal length, and each of the arcs is painted red or blue. Such a circle is said to generate a string S from every point when the following condition is satisfied:

* We will arbitrarily choose one of the N points on the perimeter and place a piece on it.
* Then, we will perform the following move M times: move the piece clockwise or counter-clockwise to an adjacent point.
* Here, whatever point we choose initially, it is always possible to move the piece so that the color of the i-th arc the piece goes along is S_i, by properly deciding the directions of the moves.



Assume that, if S_i is `R`, it represents red; if S_i is `B`, it represents blue. Note that the directions of the moves can be decided separately for each choice of the initial point.

You are given a string S of length M consisting of `R` and `B`. Out of the 2^N ways to paint each of the arcs red or blue in a circle whose perimeter is divided into N arcs of equal length, find the number of ways resulting in a circle that generates S from every point, modulo 10^9+7.

Note that the rotations of the same coloring are also distinguished.

Constraints

* 2 \leq N \leq 2 \times 10^5
* 1 \leq M \leq 2 \times 10^5
* |S|=M
* S_i is `R` or `B`.

Input

Input is given from Standard Input in the following format:


N M
S


Output

Print the number of ways to paint each of the arcs that satisfy the condition, modulo 10^9+7.

Examples

Input

4 7
RBRRBRR


Output

2


Input

3 3
BBB


Output

4


Input

12 10
RRRRBRRRRB


Output

78
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int,int> P;
typedef pair<int,P> P1;
typedef pair<P,P> P2;
#define pu push
#define pb push_back
#define mp make_pair
#define eps 1e-7
#define INF 1000000000
#define mod 1000000007
#define fi first
#define sc second
#define rep(i,x) for(int i=0;i<x;i++)
#define repn(i,x) for(int i=1;i<=x;i++)
#define SORT(x) sort(x.begin(),x.end())
#define ERASE(x) x.erase(unique(x.begin(),x.end()),x.end())
#define POSL(x,v) (lower_bound(x.begin(),x.end(),v)-x.begin())
#define POSU(x,v) (upper_bound(x.begin(),x.end(),v)-x.begin())

int n;
int m;
string s;
int mn = INF;
ll ans ;
ll dp[200005][2][2];

struct RMQ{
	#define ss (1<<19)
	ll seg[ss];
	void update(int k,ll a){
		k+=ss/2-1; seg[k]=a;
		while(k>0){
			k=(k-1)/2;
			seg[k]=(seg[k*2+1]+seg[k*2+2])%mod;
		}
	}
	ll query(int a,int b,int k,int l,int r){
		if(r<a || b<l) return 0;
		if(a<=l && r<=b) return seg[k];
		else{
			ll vl=query(a,b,k*2+1,l,(l+r)/2);
			ll vr=query(a,b,k*2+2,(l+r)/2+1,r);
			return (vl+vr)%mod;
		}
	}
}rmq[2];

int main(){
	cin>>n>>m>>s;
    	if(s[0] == 'B'){
    		rep(i,m){
    			if(s[i] == 'B') s[i] = 'R';
    			else s[i] = 'B';
    		}
    	}
		int cur = 0;
		char ch;
		bool beg = 0;
		int C = 0;
		rep(i,m){
			if(i == 0){
				ch = s[i];
				cur = 1;
			}
			else if(ch != s[i]){
				if(ch == 'R'){
					if(cur%2 == 1) mn = min(mn,cur);
					else if(!beg) mn = min(mn,cur+1);
					beg = 1; 
				}
					ch = s[i];
					cur = 1; C++;
				
			}
			else cur++;
		}
				if(ch == 'R'){
					/*if(cur%2 == 1) mn = min(mn,cur);
					else if(!beg) mn = min(mn,cur+1);
					beg = 1; */
				}
				C++;
				
		if(C == 1){
			//BBが存在しなければOK
			dp[0][0][0] = dp[0][1][1] = 1;
			for(int i=0;i<n-1;i++){
				rep(x,2){
					dp[i+1][0][x] += dp[i][0][x];
					dp[i+1][1][x] += dp[i][0][x];
					dp[i+1][0][x] += dp[i][1][x];
					dp[i+1][0][x] %= mod;
					dp[i+1][1][x] %= mod;
				}
			}
			cout<<((dp[n-1][0][0]+dp[n-1][0][1]+dp[n-1][1][0])%mod+mod)%mod<<endl;
		}
		else{
			dp[0][0][0] = 1;
			rmq[0].update(0,1);
			for(int i=2;i<n;i+=2){
				dp[i][0][0] = rmq[i%2].query(max(0,i-mn-1),i,0,0,(1<<18)-1);
				rmq[i%2].update(i,dp[i][0][0]);
			}
			ll ans = 0;
			for(int m=1;m<=n;m++){
				if(m-1 > mn) continue;
				if((m-1)%2 == 0) continue;
				ans += dp[n-m][0][0] * 1LL * m % mod;
			}
			cout << (ans%mod+mod)%mod << endl;
		
		}
	
}