#include <bits/stdc++.h>
using namespace std;
void RD(int &x) { scanf("%d", &x); }
void RD(long long &x) { scanf("%I64d", &x); }
void RD(double &x) { scanf("%lf", &x); }
void RD(int &x, int &y) { scanf("%d%d", &x, &y); }
void RD(long long &x, long long &y) { scanf("%I64d%I64d", &x, &y); }
void RD(double &x, double &y) { scanf("%lf%lf", &x, &y); }
void RD(char *s) { scanf("%s", s); }
void RD(char &s) { scanf("%c", &s); }
void RD(string &s) { cin >> s; }
void PR(int x) { printf("%d\n", x); }
void PR(int x, int y) { printf("%d %d\n", x, y); }
void PR(long long x) { printf("%I64d\n", x); }
void PR(char x) { printf("%c\n", x); }
void PR(char *x) { printf("%s\n", x); }
void PR(string x) { cout << x << endl; }
const long long inf = 1;
const long long mod = 1000000007LL;
char arr[1010][1010];
set<char> ms;
int main() {
  int i, j, k, n, m;
  long long ans;
  while (scanf("%d %d", &n, &m) == 2) {
    for ((i) = 0; (i) < (int)(n); (i)++) scanf("%s", arr[i]);
    ans = 1LL;
    for ((i) = 0; (i) < (int)(m); (i)++) {
      (ms.clear());
      for ((j) = 0; (j) < (int)(n); (j)++) {
        ms.insert(arr[j][i]);
      }
      ans = (ans * (long long)(int)ms.size()) % mod;
    }
    PR(ans);
  }
  return 0;
}
