#include <bits/stdc++.h>
using namespace std;
inline int read() {
  static char ch;
  bool sgn = false;
  while (ch = getchar(), ch < '0' || ch > '9')
    if (ch == '-') sgn = true;
  int res = ch - 48;
  while (ch = getchar(), ch >= '0' && ch <= '9') res = res * 10 + ch - 48;
  return sgn ? -res : res;
}
const int INF = 1 << 30;
const int N = 300005;
int m, n, k, cnt, cost, S, T, cc[N], c[N], pre[N], prd[N], tot;
bool bo[N];
vector<int> Eid[N];
struct Edge {
  int c, w, v;
} E[N];
void AddEdge(int x, int y, int c, int w) {
  E[++cnt].v = y;
  E[cnt].c = c;
  E[cnt].w = w;
  Eid[x].push_back(cnt);
  E[++cnt].v = x;
  E[cnt].c = -c;
  E[cnt].w = 0;
  Eid[y].push_back(cnt);
}
bool spfa() {
  static int Q[N * 2];
  int ql, qr;
  Q[ql = qr = 0] = S;
  fill(c, c + T + 1, INF);
  cc[T] = 0;
  cc[S] = INF;
  c[S] = 0;
  while (ql <= qr) {
    int x = Q[ql++];
    bo[x] = 0;
    for (int i = 0; i < Eid[x].size(); i++) {
      const Edge &e = E[Eid[x][i]];
      if (e.w && e.c + c[x] < c[e.v]) {
        if (!bo[e.v]) Q[++qr] = e.v;
        bo[e.v] = 1;
        c[e.v] = e.c + c[x];
        cc[e.v] = min(e.w, cc[x]);
        pre[e.v] = x;
        prd[e.v] = Eid[x][i];
      }
    }
  }
  return cc[T] > 0;
}
int MaxFlow() {
  cost = 0;
  while (spfa()) {
    int k = T;
    while (k != S) {
      E[prd[k]].w -= cc[T];
      E[prd[k] ^ 1].w += cc[T];
      k = pre[k];
    }
    cost += cc[T] * c[T];
  }
  return cost;
}
int cal(int x) {
  int res = 0;
  while (x) res += x & 1, x >>= 1;
  return res;
}
int a[300], ans[300], fir[300], ans0;
string s[300];
int main() {
  cnt = -1;
  n = read();
  m = read();
  T = n + n + m + 1;
  for (int i = 1; i <= n; i++) a[i] = read();
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (a[i] == a[j])
        AddEdge(i, j + n, 0, 1);
      else
        AddEdge(i, j + n, cal(a[j]), 1);
  for (int i = 1; i <= n; i++) AddEdge(S, i, 0, 1), AddEdge(i + n, T, 0, 1);
  for (int i = 2 * n + 1; i < T; i++) AddEdge(S, i, 0, 1);
  for (int i = 2 * n + 1; i < T; i++)
    for (int j = n + 1; j <= 2 * n; j++) AddEdge(i, j, cal(a[j - n]), 1);
  MaxFlow();
  for (int i = 2 * n + 1; i < T; i++) {
    for (int j = Eid[i].size() - 1; j >= 0; j--)
      if (E[Eid[i][j]].w == 0 && E[Eid[i][j]].v > n)
        ans[E[Eid[i][j]].v - n] = i - 2 * n - 1, fir[E[Eid[i][j]].v - n] = 1,
                             ans0++;
  }
  for (int i = 1; i <= n; i++) {
    for (int j = Eid[i].size() - 1; j >= 0; j--)
      if (E[Eid[i][j]].w == 0 && E[Eid[i][j]].v > n &&
          (a[E[Eid[i][j]].v - n]) != (a[i]))
        ans0++;
  }
  cout << ans0 + n << " " << cost << endl;
  for (int i = 1; i <= n; i++) {
    if (fir[i]) printf("%c=%d\n", 'a' + ans[i], a[i]);
    printf("print(%c)\n", 'a' + ans[i]);
    for (int j = Eid[i].size() - 1; j >= 0; j--)
      if (E[Eid[i][j]].w == 0 && E[Eid[i][j]].v > n &&
          (a[E[Eid[i][j]].v - n]) != (a[i]))
        ans[E[Eid[i][j]].v - n] = ans[i], fir[E[Eid[i][j]].v - n] = 1;
      else if (E[Eid[i][j]].w == 0 && E[Eid[i][j]].v > n &&
               (a[E[Eid[i][j]].v - n]) == (a[i]))
        ans[E[Eid[i][j]].v - n] = ans[i];
  }
}
