#include <bits/stdc++.h>
using namespace std;
long long arr[500007], brr[500007], crr[500007];
long long ar[1000][1000], br[1000][1000], cr[1000][1000];
char att[1000], m1, m2;
long long d1, d2, d3, d4, d5, d6, d7;
string g, h, v;
vector<long long> v2;
int main() {
  long long a, b, c, d, e, f, i, j, k, l, m, n, r, t, w, x, y, z, ans, sum;
  d = 0, e = 0, f = 0, l = 0, n = 0, ans = 0, sum = 0;
  cin >> a >> b;
  vector<char> v1[1000];
  for (i = 1; i <= a; i++) {
    cin >> g;
    for (j = 0; j < g.size(); j++) {
      v1[i].push_back(g[j]);
    }
  }
  ans = 1;
  for (j = 0; j < b; j++) {
    set<char> st1;
    for (i = 1; i <= a; i++) {
      st1.insert(v1[i][j]);
    }
    ans *= st1.size();
    k = 1e9 + 7;
    ans %= k;
  }
  cout << ans << endl;
  return 0;
}
