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>

#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define forn(i, n) for (int i = 0; i < (int)(n); ++i)
#define for1(i, n) for (int i = 1; i <= (int)(n); ++i)
#define ford(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define fore(i, a, b) for (int i = (int)(a); i <= (int)(b); ++i)

using namespace std;

typedef pair<int, int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
typedef vector<vi> vvi;
typedef long long i64;
typedef vector<i64> vi64;
typedef vector<vi64> vvi64;
typedef pair<i64, i64> pi64;
typedef double ld;

template<class T> bool uin(T &a, T b) { return a > b ? (a = b, true) : false; }
template<class T> bool uax(T &a, T b) { return a < b ? (a = b, true) : false; }

const int maxn = 210000;
const i64 P = 1000000000 + 7;
i64 dp[2][2][maxn];

void add(i64 &x, i64 y) {
    x += y;
    x %= P;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.precision(10);
    cout << fixed;
#ifdef LOCAL_DEFINE
    freopen("input.txt", "rt", stdin);
#endif

    int n, l;
    string s;
    cin >> n >> l >> s;
    char c0 = s[0], c1 = c0 ^ 'R' ^ 'B';
    if (s == string(l, c0)) {
        forn(i, 2) dp[i][i][1] = 1;
        for1(i, n - 1) forn(f, 2) forn(j, 2) forn(k, 2) {
            if (j && k) continue;
            add(dp[f][k][i + 1], dp[f][j][i]);
        }
        i64 ans = 0;
        forn(f, 2) forn(j, 2) {
            if (f && j) continue;
            add(ans, dp[f][j][n]);
        }
        cout << ans << '\n';
        return 0;
    }

    if (n % 2) {
        cout << 0 << '\n';
        return 0;
    }

    vector<pair<int, char> > cl;
    pii p = {1, c0};
    for1(i, l - 1) {
        if (s[i] == p.se) ++p.fi;
        else cl.pb(p), p = {1, s[i]};
    }

//    for (auto w: cl) cerr << w.fi << ' ' << w.se << '\n';

    int ub = n;
    if (cl[0].fi % 2 == 0) ub = cl[0].fi + 1;
    for (auto w: cl) if (w.se == c0 && w.fi % 2) uin(ub, w.fi);
    ub /= 2;

    vi64 vals(n / 2 + 1), svals(n / 2 + 2);
    vals[0] = 1;
    svals[1] = 1;
    cerr << ub << '\n';
    for1(i, n / 2) {
        vals[i] = svals[i] - svals[max(i - ub - 1, 0)];
        vals[i] %= P;
//        cerr << i << ' ' << vals[i] << '\n';
        svals[i + 1] = (svals[i] + vals[i]) % P;
    }

    i64 ans = vals[n / 2];
    for1(i, ub) if (i + 1 <= n / 2) add(ans, vals[n / 2 - i - 1] * i);
    ans *= 2;
    ans %= P;
    if (ans < 0) ans += P;
    cout << ans << '\n';

#ifdef LOCAL_DEFINE
    cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
#endif
    return 0;
}
