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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {
	static final long MOD = 1000000007;
	
	public static void main(String[] args) throws IOException {
		MyScanner sc = new MyScanner();
		PrintWriter out = new PrintWriter(System.out);
		int N = sc.nextInt();
		int M = sc.nextInt();
		char[] arr = sc.next().toCharArray();
		char first = arr[0];
		int minOdd = Integer.MAX_VALUE;
		int idx = 0;
		boolean firstPass = true;
		while (idx < M) {
			int cantFirst = 0;
			while (idx < M && arr[idx] == first) {
				cantFirst++;
				idx++;
			}
			if (idx < M) {
				if (firstPass && cantFirst % 2 == 0) cantFirst++;
				if (cantFirst % 2 == 1) {
					minOdd = Math.min(minOdd, cantFirst);
				}
				while (idx < M && arr[idx] != first) {
					idx++;
				}
			}
			firstPass = false;
		}
		long ans = 0;
		if (minOdd == Integer.MAX_VALUE) {
			long[][][] table = new long[2][2][N-1];
			
			table[0][1][0] = table[1][0][0] = table[0][0][0] = 1;
			for (int size = 1; size < N - 1; size++) {
				for (int i = 0; i < 2; i++) {
					for (int j = 0; j < 2; j++) {
						table[i][j][size] = table[0][j][size-1];
						if (i != 1) {
							table[i][j][size] += table[1][j][size-1];
							table[i][j][size] %= MOD;
						}
					}
				}
			}
			for (int i = 0; i < 2; i++) {
				for (int j = 0; j < 2; j++) if (i != 1 || j != 1) {
					ans += table[i][j][N - 2];
					ans %= MOD;
				}
			}
		} else if (N % 2 == 0) {
			int maxStep = (minOdd + 1) / 2;
			int tot = N / 2;
			long[] table = new long[tot + 1];
			long[] acum = new long[tot + 1];
			table[0] = 1;
			acum[0] = 1;
			for (int i = 1; i < tot; i++) {
				table[i] = (acum[i - 1] + MOD - (i - maxStep - 1 >= 0 ? acum[i - maxStep - 1] : 0)) % MOD;
				acum[i] = (acum[i - 1] + table[i]) % MOD;
			}
			for (int i = 1; i <= tot && i <= maxStep; i++) {
				ans += table[tot - i] * 2 * i;
				ans %= MOD;
			}
		}
		out.println(ans);
		
		out.flush();
	}
	
	static class MyScanner {
		private BufferedReader br;
		private StringTokenizer tokenizer;
		
		public MyScanner() {
			br = new BufferedReader(new InputStreamReader(System.in));
		}
		
		public String next() {
			while (tokenizer == null || !tokenizer.hasMoreTokens()) {
				try {
					tokenizer = new StringTokenizer(br.readLine());
				} catch (IOException e) {
					throw new RuntimeException(e);
				}
			}
			return tokenizer.nextToken();
		}
		
		public int nextInt() {
			return Integer.parseInt(next());
		}
		
		public long nextLong() {
			return Long.parseLong(next());
		}
	}
}
