#include <bits/stdc++.h>
using namespace std;
const int oo = INT_MAX >> 1;
struct edge {
  int u, v, c, d, n;
};
struct MCMF {
  edge a[500000];
  int H[1100], dis[1100], in[1100], pre[1100], cnt, T;
  queue<int> Q;
  void add(int u, int v, int c, int d) {
    a[cnt].u = u;
    a[cnt].v = v;
    a[cnt].c = c;
    a[cnt].d = d;
    a[cnt].n = H[u];
    H[u] = cnt++;
  }
  void build(int u, int v, int c, int d) {
    add(u, v, c, d);
    add(v, u, 0, -d);
  }
  void init(int t) {
    T = t;
    cnt = 0;
    memset(H, -1, sizeof(H));
  }
  int mcmf() {
    int i, tt, u, v, c, d, res = 0;
    for (;;) {
      for (i = 1; i <= T; i++) dis[i] = oo;
      dis[0] = 0;
      memset(in, 0, sizeof(in));
      Q.push(0);
      while (!Q.empty()) {
        u = Q.front();
        Q.pop();
        in[u] = 0;
        for (tt = H[u]; ~tt; tt = a[tt].n) {
          if (!a[tt].c) continue;
          v = a[tt].v;
          d = a[tt].d;
          if (dis[u] + d < dis[v]) {
            dis[v] = dis[u] + d;
            pre[v] = tt;
            if (!in[v]) {
              Q.push(v);
              in[v] = 1;
            }
          }
        }
      }
      if (dis[T] == oo) return res;
      res += dis[T];
      v = T;
      while (v) {
        tt = pre[v];
        --a[tt].c;
        ++a[tt ^ 1].c;
        v = a[tt].u;
      }
    }
  }
  void solve(int N, int w[]) {
    int ans = mcmf(), line = N;
    int i, j, tt;
    memset(pre, 0, sizeof(pre));
    for (tt = 0; tt < cnt; tt += 2) {
      i = a[tt].u;
      j = a[tt].v;
      if (!i) continue;
      if (i == N * 2 + 1) i = 0;
      if (0 <= i && i <= N && N + 1 <= j && j <= N * 2 && !a[tt].c) {
        j -= N;
        pre[j] = i;
        if (a[tt].d) ++line;
      }
    }
    cout << line << ' ' << ans << endl;
    char v = 'a', c;
    for (i = 1; i <= N; i++) {
      if (!pre[i]) {
        c = v++;
        cout << c << '=' << w[i] << endl;
      } else {
        c = pre[pre[i]];
        if (w[i] != w[pre[i]]) cout << c << '=' << w[i] << endl;
      }
      cout << "print(" << c << ")" << endl;
      pre[i] = c;
    }
  }
};
MCMF E;
int a[300], c[300];
int main() {
  int N, M;
  cin >> N >> M;
  int T = N + N + 1 + 1;
  E.init(T);
  int i, j;
  for (i = 1; i <= N; i++) {
    cin >> a[i];
    for (j = 0; j < 31; j++)
      if (a[i] & (1 << j)) ++c[i];
  }
  int x = N + N + 1;
  E.build(0, x, M, 0);
  for (i = 1; i <= N; i++) {
    E.build(0, i, 1, 0);
    E.build(i + N, T, 1, 0);
    E.build(x, i + N, 1, c[i]);
    for (j = i + 1; j <= N; j++) E.build(i, j + N, 1, a[i] == a[j] ? 0 : c[j]);
  }
  E.solve(N, a);
}
