#include <bits/stdc++.h>
int a, b, c, d, e, f, g[1005], h, i, j, k;
struct node {
  int u, v, w, va;
  int next;
};
struct node G[1000005];
int end[1005];
int D[1005];
int que[100005], l, r;
int v[1005];
int qq[1005];
int from[1005];
int Y[1005];
int an1, an2;
int Min(int x, int y) {
  if (x < y) return x;
  return y;
}
void Add_Edge(int u, int v, int w, int va) {
  G[++e].u = u;
  G[e].v = v;
  G[e].w = w;
  G[e].va = va;
  G[e].next = end[u];
  end[u] = e;
}
int In(int x) {
  int kk = 0;
  while (x != 0) {
    kk++;
    x -= (x & (-x));
  }
  return kk;
}
void Change(int x, int y) {
  G[x].w -= y;
  if (x & 1)
    x++;
  else
    x--;
  G[x].w += y;
}
int Find_Way(int q, int z) {
  int ii, jj, kk;
  for (ii = 1; ii <= a + a + 3; ii++) D[ii] = 1 << 23;
  for (ii = 1; ii <= a + a + 3; ii++) qq[ii] = -1;
  memset(v, 0, sizeof(v));
  D[q] = 0;
  l = 0;
  r = 1;
  que[1] = q;
  v[1] = 1;
  while (l < r) {
    l++;
    jj = end[que[l]];
    while (jj) {
      if (G[jj].w > 0 && D[que[l]] + G[jj].va < D[G[jj].v]) {
        D[G[jj].v] = D[que[l]] + G[jj].va;
        qq[G[jj].v] = jj;
        if (v[G[jj].v] == 0) {
          v[G[jj].v] = 1;
          que[++r] = G[jj].v;
        }
      }
      jj = G[jj].next;
    }
    v[que[l]] = 0;
  }
  if (D[z] < 0) return 1;
  return 0;
}
int L(int q, int z) {
  int ii, jj, kk;
  int R;
  kk = 0;
  R = 0;
  jj = 0;
  while (Find_Way(q, z)) {
    kk = (1 << 23);
    d++;
    for (ii = z; ii != q; ii = G[qq[ii]].u) kk = Min(kk, G[qq[ii]].w);
    for (ii = z; ii != q; ii = G[qq[ii]].u) Change(qq[ii], kk);
    R += kk;
  }
  return R;
}
int main() {
  scanf("%d%d", &a, &b);
  for (i = 1; i <= a; i++) scanf("%d", &g[i]);
  Add_Edge(1, 2, b, 0);
  Add_Edge(2, 1, 0, 0);
  for (i = 1; i <= a; i++) {
    h = In(g[i]);
    Add_Edge(2, 2 + i, 1, h);
    Add_Edge(2 + i, 2, 0, -h);
    Add_Edge(2 + i, 2 + i + a, 1, -(1 << 23));
    Add_Edge(2 + i + a, 2 + i, 0, (1 << 23));
    Add_Edge(2 + i + a, 3 + a + a, 1, 0);
    Add_Edge(3 + a + a, 2 + i + a, 0, 0);
  }
  for (i = 1; i <= a; i++)
    for (j = i + 1; j <= a; j++)
      if (g[i] == g[j]) {
        Add_Edge(2 + i + a, 2 + j, 1, 0);
        Add_Edge(2 + j, 2 + i + a, 0, 0);
      } else {
        h = In(g[j]);
        Add_Edge(2 + i + a, 2 + j, 1, h);
        Add_Edge(2 + j, 2 + i + a, 0, -h);
      }
  k = L(1, 3 + a + a);
  for (i = 1; i <= a; i++) {
    j = end[2 + i];
    while (j) {
      if (j & 1)
        k = j + 1;
      else
        k = j - 1;
      if (G[k].w == 0) {
        if (G[k].u == 2)
          from[i] = -5;
        else
          from[i] = G[k].u - a - 2;
        break;
      }
      j = G[j].next;
    }
  }
  c = 0;
  an1 = 0;
  an2 = 0;
  for (i = 1; i <= a; i++) {
    if (from[i] == -5) {
      c++;
      Y[i] = c;
      an2 += In(g[i]);
      an1 += 2;
      continue;
    } else
      Y[i] = Y[from[i]];
    if (g[i] != g[from[i]]) {
      an1++;
      an2 += In(g[i]);
    }
    an1++;
  }
  printf("%d %d\n", an1, an2);
  c = 0;
  an1 = 0;
  an2 = 0;
  for (i = 1; i <= a; i++) {
    if (from[i] == -5) {
      c++;
      Y[i] = c;
      printf("%c=%d\n", c + 'a' - 1, g[i]);
      an2 += In(g[i]);
      printf("print(%c)\n", c + 'a' - 1);
      an1 += 2;
      continue;
    } else
      Y[i] = Y[from[i]];
    if (g[i] != g[from[i]]) {
      an1++;
      printf("%c=%d\n", Y[i] + 'a' - 1, g[i]);
      an2 += In(g[i]);
    }
    an1++;
    printf("print(%c)\n", Y[i] + 'a' - 1);
  }
  return 0;
}
