#include <bits/stdc++.h>
using namespace std;
int ipow(int base, int exp) {
  int result = 1;
  for (;;) {
    if (exp & 1) result *= base;
    exp >>= 1;
    if (!exp) break;
    base *= base;
  }
  return result;
}
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> vec(n);
  for (int i = 0; i < n; i++) {
    cin >> vec[i];
  }
  long long int prod = 1;
  string s;
  set<char> st;
  if (n == 1) {
    cout << "1" << endl;
    return 0;
  }
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) {
      s = vec[j];
      st.insert(s[i]);
    }
    prod = (prod * st.size());
    prod = prod % 1000000007;
    st.clear();
  }
  cout << prod << endl;
  return 0;
}
