#include <bits/stdc++.h>
using namespace std;
queue<int> q;
struct edge {
  edge *nxt;
  int des, cst;
  bool flw;
  void maker(edge *&a, int b, bool c, int d) {
    nxt = a, des = b, flw = c, cst = d;
    a = this;
  }
} * tot, w[1000000], *sta[555], *lst[555];
int a[255], dis[555], f[255], co[255];
bool p[555];
void makeedge(int a, int b, int c, int d) {
  (tot++)->maker(sta[a], b, c, d);
  (tot++)->maker(sta[b], a, 0, -d);
}
int main() {
  int n, m, i, j, b, c, tim, res;
  scanf("%d%d", &n, &m);
  for (i = 0; i <= n * 2 + 1; i++) sta[i] = NULL;
  for (tot = w, a[0] = -1, a[n + 1] = 0, i = 1; i <= n + 1; i++) {
    if (i <= n) scanf("%d", a + i);
    for (b = a[i], c = 0; b; b -= b & -b, c++)
      ;
    for (j = 0; j < i; j++) makeedge(j * 2, i * 2 - 1, 1, a[i] != a[j] ? c : 0);
    if (i <= n) makeedge(i * 2 - 1, i * 2, 1, -(1 << 20));
  }
  for (i = 0; i < m; i++) {
    for (dis[0] = 0, j = 1; j <= n * 2 + 1; j++) dis[j] = 1 << 20, p[j] = 0;
    for (q.push(0); !q.empty();) {
      p[b = q.front()] = 0;
      q.pop();
      for (edge *e = sta[b]; e; e = e->nxt)
        if (e->flw && dis[b] + e->cst < dis[e->des]) {
          dis[e->des] = dis[b] + e->cst;
          lst[e->des] = e;
          if (!p[e->des]) {
            p[e->des] = 1;
            q.push(e->des);
          }
        }
    }
    if (dis[n * 2 + 1] >= 0) {
      m = i;
      break;
    }
    for (j = n * 2 + 1; j; j = w[lst[j] - w ^ 1].des) {
      w[lst[j] - w ^ 1].flw = 1;
      lst[j]->flw = 0;
    }
  }
  for (i = 1; i <= n; i++) {
    for (edge *e = sta[i * 2 - 1]; e; e = e->nxt)
      if (e->des < i * 2 && e->flw) f[i] = (e->des + 1) / 2;
  }
  for (tim = res = 0, i = 1; i <= n; i++)
    if (a[i] != a[f[i]]) {
      for (b = a[i], c = 0; b; b -= b & -b, c++)
        ;
      tim++, res += c;
    }
  printf("%d %d\n", tim + n, res);
  for (c = 0, i = 1; i <= n; i++) {
    if (f[i] == 0) {
      co[i] = c;
      printf("%c=%d\n", c + 'a', a[i]);
      c++;
    } else {
      co[i] = co[f[i]];
      if (a[i] != a[f[i]]) printf("%c=%d\n", co[i] + 'a', a[i]);
    }
    printf("print(%c)\n", co[i] + 'a');
  }
  return 0;
}
