#include <bits/stdc++.h>
using namespace std;
const int N = 258, M = 30, P = N << 1, E = (N * N) + 4 * N, INF = 0x7fffffff;
int n, m, a[N], Last[M], sz, tot, step, head[P], dis[P], s, t, ss, tt, _s,
    fa[P], mem[P], ans, bel[N], cur;
bool in[P];
queue<int> q;
struct Tflow {
  int next, node, flow, cost;
} e[E << 2];
inline void add(int x, int y, int z, int c) {
  e[++tot].next = head[x], head[x] = tot, e[tot].node = y, e[tot].flow = z,
  e[tot].cost = c;
  e[++tot].next = head[y], head[y] = tot, e[tot].node = x, e[tot].flow = 0,
  e[tot].cost = -c;
}
struct Operator {
  int ty, v, p;
  Operator(int _ty = 0, int _v = 0, int _p = 0) {
    ty = _ty;
    v = _v;
    p = _p;
  }
  void out() {
    if (ty == 0)
      printf("%c=%d\n", p + 'a' - 1, v);
    else
      printf("print(%c)\n", p + 'a' - 1);
  }
} op[N << 1];
bool SFPA() {
  while (!q.empty()) q.pop();
  for (int i = 1; i <= sz; i++) dis[i] = INF;
  memset(in, 0, sizeof(in));
  dis[s] = 0;
  q.push(s);
  in[s] = 1;
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    in[u] = 0;
    for (int i = head[u], v; v = e[i].node, i; i = e[i].next)
      if (e[i].flow > 0 && e[i].cost + dis[u] < dis[v]) {
        dis[v] = dis[u] + e[i].cost;
        fa[v] = u;
        mem[v] = i;
        if (!in[v]) in[v] = 1, q.push(v);
      }
  }
  return dis[t] < INF;
}
void EK() {
  while (SFPA() == 1) {
    int Min = INF, cnt = 0;
    for (int u = t; u != s; u = fa[u]) {
      int i = mem[u];
      cnt += e[i].cost;
      Min = min(Min, e[i].flow);
    }
    ans += cnt * Min;
    for (int u = t; u != s; u = fa[u]) {
      int i = mem[u];
      e[i].flow -= Min;
      e[i ^ 1].flow += Min;
    }
  }
}
void solve() {
  sz = n + n;
  tot = 1;
  _s = ++sz;
  ss = ++sz;
  tt = ++sz;
  s = ++sz, t = ++sz;
  add(ss, _s, m, 0);
  for (int i = 1; i <= n; i++) {
    add(_s, i, 1, __builtin_popcount(a[i]));
    add(i + n, tt, 1, 0);
    add(s, i + n, 1, 0);
    add(i, t, 1, 0);
    for (int j = i + 1; j <= n; j++) {
      if (a[i] == a[j])
        add(i + n, j, 1, 0);
      else
        add(i + n, j, 1, __builtin_popcount(a[j]));
    }
  }
  add(tt, ss, INF, 0);
  EK();
}
void calc(int u) {
  bel[u] = cur;
  u += n;
  for (int i = head[u], v; v = e[i].node, i; i = e[i].next)
    if (!e[i].flow && v >= 1 && v <= n) {
      calc(v);
      break;
    }
}
void write() {
  for (int i = head[_s], v; v = e[i].node, i; i = e[i].next)
    if (!e[i].flow && v >= 1 && v <= n) {
      ++cur;
      calc(v);
    }
  for (int i = 1; i <= n; i++) {
    if (a[i] != Last[bel[i]])
      op[++step] = Operator(0, a[i], bel[i]), Last[bel[i]] = a[i];
    op[++step] = Operator(1, 0, bel[i]);
  }
  printf("%d %d\n", step, ans);
  for (int i = 1; i <= step; i++) op[i].out();
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  solve();
  write();
  return 0;
}
