#include<bits/stdc++.h>
#define FOR(i, a, b) for (int i = (a), _b = (b); i <= _b; i++)
#define FORD(i, b, a) for (int i = (b), _a = (a); i >= _a; i--)
#define REP(i, n) for (int i = 0, _n = (n); i < _n; i++)
#define FORE(i, v) for (__typeof((v).begin()) i = (v).begin(); i != (v).end(); i++)
#define ALL(v) (v).begin(), (v).end()
#define IS_INF(x)   (std::isinf(x))
#define IS_NAN(x)   (std::isnan(x))
#define fi   first
#define se   second
#define MASK(i) (1LL << (i))
#define BIT(x, i) (((x) >> (i)) & 1)
#define div   ___div
#define next   ___next
#define prev   ___prev
#define left   ___left
#define right   ___right
#define __builtin_popcount __builtin_popcountll
using namespace std;
template<class X, class Y>
    bool minimize(X &x, const Y &y) {
        X eps = 1e-9;
        if (x > y + eps) {
            x = y;
            return true;
        } else return false;
    }
template<class X, class Y>
    bool maximize(X &x, const Y &y) {
        X eps = 1e-9;
        if (x + eps < y) {
            x = y;
            return true;
        } else return false;
    }
template<class T>
    T Abs(const T &x) {
        return (x < 0 ? -x : x);
    }

/* Author: Van Hanh Pham */

/** END OF TEMPLATE - ACTUAL SOLUTION COMES HERE **/

const int INF = (int)1e9 + 7;
const int MOD = (int)1e9 + 7;
void add(int &x, const int &y) {
    x += y;
    if (x >= MOD) x -= MOD;
}

#define MAX_GROUP   111
struct Node {
    Node *child[26];
    bool hasWord;
    int numWord;
    pair<int, int> dp[MAX_GROUP];

    Node() {
        REP(i, 26) child[i] = NULL;
        hasWord = false;
        numWord = 0;
    }
};

Node *root;
int numWord, numGroup;
int comb[MAX_GROUP][MAX_GROUP], frac[MAX_GROUP];

void init(void) {
    cin >> numWord >> numGroup;

    root = new Node();
    REP(love, numWord) {
        string word; cin >> word;
        Node *p = root;
        FORE(it, word) {
            Node *&child = p->child[*it - 'A'];
            if (child == NULL) child = new Node();
            p = child;
        }
        p->hasWord = true;
        p->numWord = 1;
    }

    FOR(i, 1, numGroup) {
        comb[i][0] = 0;
        comb[0][i] = 1;
    }
    comb[0][0] = 1;
    FOR(i, 1, numGroup) FOR(j, 1, numGroup) {
        if (i > j) comb[i][j] = 0;
        if (i == j) comb[i][j] = 1;
        if (i < j) comb[i][j] = (comb[i][j - 1] + comb[i - 1][j - 1]) % MOD;
    }
    frac[0] = 1;
    FOR(i, 1, numGroup) frac[i] = 1LL * frac[i - 1] * i % MOD;
}

void update(pair<int, int> &cur, const pair<int, int> &tmp) {
    if (maximize(cur.fi, tmp.fi)) cur.se = tmp.se;
    else if (cur.fi == tmp.fi) add(cur.se, tmp.se);
}

int countMerge(int x, int y, int z) {
    int t = x + y - z;
    return 1LL * comb[t][x] * comb[t][y] % MOD * frac[t] % MOD;
}

pair<int, int> best[MAX_GROUP], prevBest[MAX_GROUP];
void dfs(Node *p) {
    REP(i, 26) if (p->child[i] != NULL) dfs(p->child[i]);

    REP(i, numGroup + 1) best[i] = {-INF, 0};

    if (p->hasWord) best[1] = {0, 1};
    else best[0] = {0, 1};

    REP(i, 26) if (p->child[i] != NULL) {
        Node *ch = p->child[i];

        REP(j, min(p->numWord, numGroup) + 1) {
            prevBest[j] = best[j];
            best[j] = {-INF, 0};
        }

        REP(x, min(p->numWord, numGroup) + 1) REP(y, min(ch->numWord, numGroup) + 1)
            FOR(z, max(x, y), min(x + y, numGroup)) {
                int numNode = prevBest[x].fi + ch->dp[y].fi;
                int numWay = 1LL * prevBest[x].se * ch->dp[y].se % MOD * countMerge(x, y, z) % MOD;
                update(best[z], {numNode, numWay});
            }
        p->numWord += ch->numWord;
    }

    FOR(i, 1, numGroup) p->dp[i] = i <= p->numWord ? make_pair(best[i].fi + i, best[i].se) : make_pair(-INF, 0);
}

void process(void) {
    dfs(root);
    cout << root->dp[numGroup].fi << " " << 1LL * root->dp[numGroup].se * frac[numGroup] % MOD << endl;
}

int main(void) {
#ifdef ONLINE_JUDGE
    freopen("trie.inp", "r", stdin);
    freopen("trie.out", "w", stdout);
#endif // ONLINE_JUDGE
    init();
    process();
    return 0;
}

/*** LOOK AT MY CODE. MY CODE IS AMAZING :D ***/
