#include <bits/stdc++.h>
int son[2005], q[2005], d[2005], pre[2005], inq[2005], a[2005];
int link[150005], st[150005], next[150005], cap[150005], opp[150005],
    cost[150005];
int n, m, S, T, ll, maxflow, mincost;
void addedge(int x, int y, int z, int c) {
  link[++ll] = y;
  st[ll] = x;
  next[ll] = son[x];
  son[x] = ll;
  cap[ll] = z;
  cost[ll] = c;
  opp[ll] = ll + 1;
  link[++ll] = x;
  st[ll] = y;
  next[ll] = son[y];
  son[y] = ll;
  cap[ll] = 0;
  cost[ll] = -c;
  opp[ll] = ll - 1;
}
int spfa(int s) {
  int h = 0, t = 1, i, j, p;
  for (int i = 0; i <= n; ++i) d[i] = (1 << 29);
  for (int i = 0; i <= n; ++i) inq[i] = 0;
  d[S] = 0;
  q[1] = S;
  inq[S] = 1;
  while (h != t) {
    h = h < n ? h + 1 : 1;
    i = q[h];
    inq[i] = 0;
    for (p = son[i]; p != -1; p = next[p]) {
      j = link[p];
      if (d[i] + cost[p] < d[j] && cap[p]) {
        d[j] = d[i] + cost[p];
        pre[j] = p;
        if (!inq[j]) t = t < n ? t + 1 : 1, q[t] = j, inq[j] = 1;
      }
    }
  }
  return d[T] <= 0 ? 1 : 0;
}
void update() {
  int p, flow = (1 << 29);
  for (p = T; p != S; p = st[p]) {
    p = pre[p];
    if (cap[p] < flow) flow = cap[p];
  }
  maxflow += flow;
  for (p = T; p != S; p = st[p]) {
    p = pre[p];
    mincost += cost[p] * flow;
    cap[p] -= flow;
    cap[opp[p]] += flow;
  }
}
int ans = 0;
char val[2005];
int main() {
  int nn, x, y, z, w;
  ll = 0;
  scanf("%d%d", &nn, &m);
  n = nn + nn + 1;
  S = 0;
  T = nn + nn + 1;
  memset(son, -1, sizeof(int) * (n + 1));
  for (int i = 1; i <= nn; ++i) scanf("%d", &a[i]);
  for (int i = 1; i <= nn; ++i)
    addedge(S, i, 1, __builtin_popcount(a[i])), addedge(i, nn + i, 1, -10000),
        addedge(nn + i, T, 1, 0);
  for (int i = 1; i < nn; ++i)
    for (int j = i + 1; j <= nn; ++j)
      if (a[i] == a[j]) {
        addedge(i + nn, j, 1, 0);
        break;
      }
  for (int i = 1; i < nn; ++i)
    for (int j = i + 1; j <= nn && j <= i + 100; ++j)
      addedge(i + nn, j, 1, __builtin_popcount(a[j]));
  maxflow = mincost = 0;
  for (int i = 1; i <= m; ++i)
    if (!spfa(S))
      break;
    else
      update();
  mincost += nn * 10000;
  char cur = 'a';
  for (int i = 1; i <= nn; ++i)
    for (int p = son[i]; p != -1; p = next[p])
      if (cap[p] && !(p & 1))
        if (!link[p])
          ans += 2, val[i] = cur++;
        else {
          if (a[link[p] - nn] == a[i])
            ++ans;
          else
            ans += 2;
          val[i] = val[link[p] - nn];
        }
  printf("%d %d\n", ans, mincost);
  for (int i = 1; i <= nn; ++i) {
    for (int p = son[i]; p != -1; p = next[p])
      if (cap[p] && !(p & 1))
        if (!link[p] || a[link[p] - nn] != a[i])
          printf("%c=%d\n", val[i], a[i]);
    printf("print(%c)\n", val[i]);
  }
  return 0;
}
