#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 555, MAX_M = 500 * 500 * 4;
int g[MAX_M], nxt[MAX_M], cost[MAX_M], flow[MAX_M], nm, c[MAX_N];
int iq[MAX_N], d[MAX_N], pk[MAX_N], pre[MAX_N];
int S, T, n, m, ans;
int col[MAX_N], nw[MAX_N], a[MAX_N];
queue<int> q;
int calc(int x) {
  int tot = 0;
  for (; x; x -= x & (-x)) ++tot;
  return tot;
}
void addedge(int x, int y, int w, int ct) {
  g[nm] = y;
  nxt[nm] = c[x];
  c[x] = nm;
  cost[nm] = ct;
  flow[nm] = w;
  nm++;
}
void add(int x, int y, int w, int ct) {
  addedge(x, y, w, ct);
  addedge(y, x, 0, -ct);
}
bool spfa() {
  for (int i = 1; i <= T; ++i) d[i] = 1000000000;
  memset(iq, 0, sizeof iq);
  q.push(S);
  d[S] = 0;
  while (!q.empty()) {
    int i = q.front();
    q.pop();
    iq[i] = 0;
    for (int k = c[i]; ~k; k = nxt[k]) {
      int j = g[k];
      if (d[j] > d[i] + cost[k] && flow[k]) {
        d[j] = d[i] + cost[k];
        pk[j] = k;
        pre[j] = i;
        if (!iq[j]) {
          iq[j] = 1;
          q.push(j);
        }
      }
    }
  }
  return d[T] != 1000000000;
}
void aug() {
  int Fl = 1000000000;
  for (int i = T; i != S; i = pre[i]) Fl = min(Fl, flow[pk[i]]);
  ans += Fl * d[T];
  for (int i = T; i != S; i = pre[i]) {
    flow[pk[i]] -= Fl;
    flow[pk[i] ^ 1] += Fl;
  }
}
void output() {
  for (int i = n + m + 1; i <= S - 1; ++i) {
    for (int k = c[i]; ~k; k = nxt[k]) {
      int j = g[k];
      if (flow[k]) {
        if (j <= m)
          col[i - n - m] = j;
        else
          col[i - n - m] = col[j - m];
      }
    }
  }
  int ls = n;
  memset(nw, 0, sizeof nw);
  for (int i = 1; i <= n; ++i)
    if (nw[col[i]] != a[i]) {
      nw[col[i]] = a[i];
      ++ls;
    }
  memset(nw, 0, sizeof nw);
  printf("%d %d\n", ls, ans);
  for (int i = 1; i <= n; ++i) {
    if (nw[col[i]] != a[i]) {
      nw[col[i]] = a[i];
      printf("%c=%d\n", col[i] + 'a' - 1, a[i]);
    }
    printf("print(%c)\n", col[i] + 'a' - 1);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) scanf("%d", &a[i]);
  S = m + n + n + 1;
  T = S + 1;
  memset(c, -1, sizeof c);
  for (int i = 1; i <= m; ++i)
    for (int j = 1; j <= n; ++j) add(i, m + n + j, 1, calc(a[j]));
  for (int i = 1; i <= n; ++i)
    for (int j = i + 1; j <= n; ++j)
      add(m + i, m + n + j, 1, a[i] == a[j] ? 0 : calc(a[j]));
  for (int i = 1; i <= n + m; ++i) add(S, i, 1, 0);
  for (int i = n + m + 1; i <= S - 1; ++i) add(i, T, 1, 0);
  while (spfa()) aug();
  output();
}
