#include <bits/stdc++.h>
using namespace std;
const int inf = 2000000000;
int n, m, a[255], c[255], N, h[510], t[130000][4], out, var[255], w;
char q[505][15];
void adde(int x, int y, int cap, int cost) {
  t[w][0] = y;
  t[w][1] = cap;
  t[w][2] = cost;
  t[w][3] = h[x];
  h[x] = w++;
  t[w][0] = x;
  t[w][1] = 0;
  t[w][2] = -cost;
  t[w][3] = h[y];
  h[y] = w++;
}
int mcmf(int S, int T) {
  int q[515], rq, wq, d[510], f[510][2], flow[510], ret = 0;
  bool v[510];
  while (1) {
    for (int i = 0; i <= N; i++) d[i] = inf;
    memset(f, -1, sizeof(f));
    memset(v, true, sizeof(v));
    rq = wq = 0;
    q[wq++] = S;
    d[S] = 0;
    flow[S] = inf;
    v[S] = false;
    while (rq != wq) {
      int X = q[rq++];
      if (rq == 510) rq = 0;
      v[X] = true;
      for (int i = h[X]; i != -1; i = t[i][3]) {
        int Y = t[i][0];
        if ((t[i][1]) && (d[X] + t[i][2] < d[Y])) {
          d[Y] = d[X] + t[i][2];
          f[Y][0] = X;
          f[Y][1] = i;
          flow[Y] = min(flow[X], t[i][1]);
          if (v[Y]) {
            v[Y] = false;
            q[wq++] = Y;
            if (wq == 510) wq = 0;
          }
        }
      }
    }
    if (f[T][0] == -1) break;
    ret += d[T];
    for (int i = T; i != S; i = f[i][0]) {
      t[f[i][1]][1] -= flow[T];
      t[f[i][1] ^ 1][1] += flow[T];
    }
  }
  return ret;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    c[i] = 0;
    for (int j = 0; j <= 30; j++) c[i] += ((a[i] >> j) & 1);
  }
  memset(h, -1, sizeof(h));
  w = 0;
  N = n + n + 2;
  adde(0, n + n + 1, m, 0);
  for (int i = 1; i <= n; i++) {
    adde(0, i, 1, 0);
    adde(n + n + 1, n + i, 1, c[i]);
    for (int j = i + 1; j <= n; j++) adde(i, n + j, 1, a[i] == a[j] ? 0 : c[j]);
    adde(n + i, N, 1, 0);
  }
  out = mcmf(0, N);
  w = 0;
  for (int i = 1; i <= n; i++) {
    for (int j = h[n + i]; j != -1; j = t[j][3]) {
      if (t[j][1]) {
        int X = t[j][0];
        if (X == n + n + 1) {
          m--;
          sprintf(q[w++], "%c=%d", m + 'a', a[i]);
          sprintf(q[w++], "print(%c)", m + 'a');
          var[i] = m;
        } else if (a[i] == a[X]) {
          sprintf(q[w++], "print(%c)", var[X] + 'a');
          var[i] = var[X];
        } else {
          sprintf(q[w++], "%c=%d", var[X] + 'a', a[i]);
          sprintf(q[w++], "print(%c)", var[X] + 'a');
          var[i] = var[X];
        }
      }
    }
  }
  printf("%d %d\n", w, out);
  for (int i = 0; i < w; i++) printf("%s\n", q[i]);
  return 0;
}
