#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 1, 0, 0, -1};
int dy[] = {0, 0, 1, -1, 0};
const long long mod = 1000000000 + 7;
int main() {
  int n, m;
  scanf("%d", &n);
  scanf("%d", &m);
  vector<string> words(n);
  for (int i = 0; i < n; i++) cin >> words[i];
  int ans = 1;
  for (int j = 0; j < m; j++) {
    bool exist[26] = {};
    int cntr = 0;
    for (int i = 0; i < n; i++) {
      if (!exist[words[i][j] - 'A']) cntr++;
      cntr %= mod;
      exist[words[i][j] - 'A'] = 1;
    }
    ans = ((ans % mod) * (cntr % mod)) % mod;
  }
  printf("%d\n", ans);
}
