#include <bits/stdc++.h>
using namespace std;
struct Answ {
  int t, b, c;
} Q[300100];
int j, n, k, i, s, t, cnt, ed = 1, U[300100], C[300100], V[300100], W[300100],
                           nxt[300100], p[300100];
int vis[300100], d[300100], la[300100], q[300100], pre[300100], A[300100],
    B[300100], z[300100];
void Add(int u, int v, int c, int w) {
  V[++ed] = v, U[ed] = u, C[ed] = c, W[ed] = w, nxt[ed] = p[u], p[u] = ed;
  V[++ed] = u, U[ed] = v, C[ed] = 0, W[ed] = -w, nxt[ed] = p[v], p[v] = ed;
}
bool Spfa(int s, int t, int cnt) {
  int i, u, v, l = 0, r = 0;
  for (i = 0; i <= cnt; i++) d[i] = 999999999, vis[i] = false, la[i] = -1;
  vis[s] = true, d[s] = 0, q[++r] = s;
  while (l < r) {
    u = q[++l];
    vis[u] = false;
    for (i = p[u]; i != -1; i = nxt[i]) {
      v = V[i];
      if (C[i] && d[v] > d[u] + W[i]) {
        d[v] = d[u] + W[i], la[v] = i;
        if (!vis[v]) q[++r] = v, vis[v] = 1;
      }
    }
  }
  if (d[t] == 999999999) return false;
  return true;
}
int Mcmf() {
  int mc = 0, mn, i;
  while (Spfa(s, t, cnt)) {
    mn = 999999999;
    for (i = la[t]; i != -1; i = la[V[i ^ 1]]) mn = min(mn, C[i]);
    for (i = la[t]; i != -1; i = la[V[i ^ 1]]) C[i] -= mn, C[i ^ 1] += mn;
    mc += d[t] * mn;
  }
  return mc;
}
int main() {
  memset(p, -1, sizeof(p));
  scanf("%d%d", &n, &k);
  for (i = 1; i <= n; i++) {
    scanf("%d", &z[i]);
    for (int x = z[i]; x; x >>= 1) A[i] += x & 1;
  }
  s = 0, t = 2 * n + 2, cnt = 2 * n + 3;
  Add(s, t - 1, k, 0);
  for (i = 1; i <= n; i++) {
    Add(s, i, 1, 0), Add(i + n, t, 1, 0);
    Add(t - 1, i + n, 1, A[i]);
    for (j = i + 1; j <= n; j++) Add(i, j + n, 1, z[i] == z[j] ? 0 : A[j]);
  }
  int ans = Mcmf(), cz = 0, us = 0;
  for (i = 0; i <= t; i++)
    for (j = p[i]; j != -1; j = nxt[j])
      if (!(j & 1) && !C[j]) pre[V[j]] = i;
  for (i = 1; i <= n; i++) {
    j = pre[i + n];
    B[i] = (j == t - 1) ? ++us : B[j];
    if (j == n + 1 || z[j] != z[i]) Q[++cz] = (Answ){1, B[i], z[i]};
    Q[++cz] = (Answ){0, B[i]};
  }
  printf("%d %d\n", cz, ans);
  for (i = 1; i <= cz; i++)
    if (Q[i].t == 0)
      printf("print(%c)\n", Q[i].b + 'a' - 1);
    else
      printf("%c=%d\n", Q[i].b + 'a' - 1, Q[i].c);
  return 0;
}
