#include <bits/stdc++.h>
using namespace std;
int n, m, g, A[505], vis[505], fa[505], cmt;
char var[505];
int fir[505], tar[1000005], cap[1000005], cst[1000005], nex[1000005], cnt = 1;
long long d[505];
queue<int> q;
int bit(int a) {
  int ans = 0;
  for (; a; a -= a & -a) ans++;
  return ans;
}
void add(int a, int b, int c, int d) {
  ++cnt;
  tar[cnt] = b;
  cap[cnt] = c;
  cst[cnt] = d;
  nex[cnt] = fir[a];
  fir[a] = cnt;
  if (c) add(b, a, 0, -d);
}
long long SPFA(int s, int t) {
  for (int i = 1; i <= g; i++) d[i] = 0x3f3f3f3f;
  d[t] = 0;
  while (!q.empty()) q.pop();
  q.push(t);
  vis[t] = 1;
  while (!q.empty()) {
    int x = q.front();
    q.pop();
    for (int i = fir[x]; i; i = nex[i]) {
      if (cap[i ^ 1]) {
        int v = tar[i];
        if (d[x] + cst[i ^ 1] < d[v]) {
          d[v] = d[x] + cst[i ^ 1];
          fa[v] = i ^ 1;
          if (!vis[v]) q.push(v);
          vis[v] = 1;
        }
      }
    }
    vis[x] = 0;
  }
  return d[s];
}
long long sap(int s, int t) {
  long long ans = 1ll * n * 0x3f3f3f3f;
  while (SPFA(s, t) < 0) {
    for (int i = s; i != t; i = tar[fa[i]]) {
      cap[fa[i]]--;
      cap[fa[i] ^ 1]++;
    }
    ans += d[s];
  }
  return ans;
}
int main() {
  scanf("%d%d", &n, &m);
  add(1, 2, m, 0);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &A[i]);
    add(i + 3, i + n + 3, 1, -0x3f3f3f3f);
    add(2, i + 3, 1, bit(A[i]));
    add(i + n + 3, 3, 1, 0);
  }
  for (int i = 1; i <= n; i++)
    for (int j = i + 1; j <= n; j++)
      if (A[i] == A[j])
        add(i + n + 3, j + 3, 1, 0);
      else
        add(i + n + 3, j + 3, 1, bit(A[j]));
  g = 2 * n + 3;
  long long ans = sap(1, 3), ans1 = 0;
  for (int i = 4; i <= n + 3; i++) {
    for (int j = fir[i]; j; j = nex[j]) {
      int v = tar[j];
      if (v == i + n + 3) continue;
      if (v != 2) v -= n;
      if (cap[j] == 1)
        if (v == 2 || A[v - 3] != A[i - 3]) ans1++;
    }
  }
  ans1 += n;
  printf("%d %d\n", int(ans1), int(ans));
  for (int i = 4; i <= n + 3; i++) {
    for (int j = fir[i]; j; j = nex[j]) {
      int v = tar[j];
      if (v == i + n + 3) continue;
      if (v != 2) v -= n;
      if (cap[j] == 1) {
        if (v == 2) {
          printf("%c=%d\n", 'a' + cmt, A[i - 3]);
          var[i] = 'a' + cmt;
          cmt++;
        } else {
          var[i] = var[v];
          if (A[v - 3] != A[i - 3]) printf("%c=%d\n", var[v], A[i - 3]);
        }
        printf("print(%c)\n", var[i]);
      }
    }
  }
}
