#include <bits/stdc++.h>
using namespace std;
const int inf = 1 << 30;
int n, m, a[255], p[255];
int h[255 << 1], ent;
int S, T, SuS, SuT, flow, cost;
int in[255 << 1], q[(255 << 1) * 20], dis[255 << 1], frt[255 << 1], qt, dt, bt;
int count(int x) {
  int s = 0;
  while (x) s++, x -= x & -x;
  return s;
}
struct edge {
  int v, n, f, c;
  edge(int y = 0, int t = 0, int z = 0, int w = 0) : v(y), n(t), f(z), c(w) {}
} e[((255 * 255) << 1)];
void link(int x, int y, int f, int c) {
  e[++ent] = edge(y, h[x], f, c), h[x] = ent;
}
void flink(int x, int y, int f, int c) { link(x, y, f, c), link(y, x, 0, -c); }
bool SPFA() {
  for (int i = 1; i <= SuT; i++) in[i] = 0, dis[i] = inf;
  in[SuS] = 1, dis[SuS] = 0, q[qt = 1] = SuS;
  for (int i = 1, o; i <= qt; i++) {
    o = q[i];
    for (int x = h[o], y; y = e[x].v, x; x = e[x].n)
      if (e[x].f && dis[o] + e[x].c < dis[y]) {
        dis[y] = dis[o] + e[x].c, frt[y] = x;
        if (!in[y]) in[y] = 1, q[++qt] = y;
      }
    in[o] = 0;
  }
  if (dis[SuT] == inf) return 0;
  int nf = inf;
  for (int o = SuT, x; x = frt[o], o != SuS; o = e[x ^ 1].v)
    nf = min(e[x].f, nf);
  for (int o = SuT, x; x = frt[o], o != SuS; o = e[x ^ 1].v)
    e[x].f -= nf, e[x ^ 1].f += nf;
  cost += nf * dis[SuT];
  flow += nf;
  return 1;
}
struct opt {
  int t, x, y;
  opt() {}
  opt(int a, int b, int c) : t(a), x(b), y(c) {}
  opt(int a, int b) : t(a), x(b) {}
  void print() {
    if (t == 1)
      printf("%c=%d\n", 'a' + x - 1, y);
    else
      printf("print(%c)\n", 'a' + x - 1);
  }
} d[255 << 1];
void work() {
  while (SPFA())
    ;
  for (int i = 1; i <= n; i++) {
    int o = (((i) << 1) - 1);
    for (int x = h[o], y; y = e[x].v, x; x = e[x].n)
      if (e[x].f && y != ((i) << 1) && y != SuS) {
        if (y != S) {
          int t = y >> 1;
          if (a[t] != a[i]) d[++dt] = opt(1, p[t], a[i]);
          p[i] = p[t];
        } else {
          bt++;
          d[++dt] = opt(1, bt, a[i]);
          p[i] = bt;
        }
        d[++dt] = opt(2, p[i]);
      }
  }
  printf("%d %d\n", dt, cost);
  for (int i = 1; i <= dt; i++) d[i].print();
}
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", a + i);
  S = n * 2 + 1, T = n * 2 + 2, SuS = n * 2 + 3, SuT = n * 2 + 4;
  ent = 1;
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++) {
      flink(((i) << 1), (((j) << 1) - 1), 1, a[i] == a[j] ? 0 : count(a[j]));
      if (a[i] == a[j]) break;
    }
  for (int i = 1; i <= n; i++) flink(S, (((i) << 1) - 1), 1, count(a[i]));
  for (int i = 1; i <= n; i++) flink(((i) << 1), T, 1, 0);
  for (int i = 1; i <= n; i++)
    flink((((i) << 1) - 1), SuT, 1, 0), flink(SuS, ((i) << 1), 1, 0);
  flink(T, S, m, 0);
  work();
  return 0;
}
