#include <bits/stdc++.h>
using namespace std;
const int inf = 1e9;
const int maxm = 111111;
const int maxn = 8888;
int node, src, dest, tot;
int ver[maxm], flow[maxm], cost[maxm], nex[maxm];
int head[maxn], dis[maxn], p[maxn], q[maxn], vis[maxn];
void prepare(int _node, int _src, int _dest) {
  node = _node, src = _src, dest = _dest;
  for (int i = 0; i < node; i++) head[i] = -1, vis[i] = 0;
  tot = 0;
}
void addedge(int u, int v, int f, int c) {
  ver[tot] = v, flow[tot] = f, cost[tot] = c, nex[tot] = head[u],
  head[u] = tot++;
  ver[tot] = u, flow[tot] = 0, cost[tot] = -c, nex[tot] = head[v],
  head[v] = tot++;
}
bool spfa() {
  int i, u, v, l, r = 0, tmp;
  for (i = 0; i < node; ++i) dis[i] = inf;
  dis[q[r++] = src] = 0;
  p[src] = p[dest] = -1;
  for (l = 0; l != r; (++l >= maxn) ? l = 0 : l)
    for (i = head[u = q[l]], vis[u] = 0; i >= 0; i = nex[i])
      if (flow[i] && dis[v = ver[i]] > (tmp = dis[u] + cost[i])) {
        dis[v] = tmp;
        p[v] = i ^ 1;
        if (vis[v]) continue;
        vis[q[r++] = v] = 1;
        if (r >= maxn) r = 0;
      }
  return p[dest] > -1;
}
int SpfaFlow() {
  int i, ret = 0, delta;
  while (spfa()) {
    for (i = p[dest], delta = inf; i >= 0; i = p[ver[i]])
      if (flow[i ^ 1] < delta) delta = flow[i ^ 1];
    for (i = p[dest]; i >= 0; i = p[ver[i]])
      flow[i] += delta, flow[i ^ 1] -= delta;
    ret += delta * dis[dest];
  }
  return ret;
}
int a[maxn];
int hf[maxn];
map<int, int> mp;
int aans[maxn];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    int x;
    scanf("%d", &x);
    a[i] = x;
    while (x) {
      if (x & 1) hf[i]++;
      x /= 2;
    }
  }
  src = 0, dest = 2 * n + m + 1;
  prepare(2 * n + m + 2, src, dest);
  for (int i = 1; i <= n; i++) {
    addedge(src, i, 1, 0);
    addedge(i + n, dest, 1, 0);
  }
  for (int i = 1; i <= m; i++) {
    addedge(src, 2 * n + i, 1, 0);
  }
  int x = 0;
  for (int i = 1; i <= n; i++) {
    if (mp[a[i]] == 0) {
      addedge(2 * n + (++x), i + n, 1, hf[i]);
      mp[a[i]] = 1;
      if (x == m) break;
    }
  }
  for (int i = 1; i <= n; i++) {
    for (int j = i + 1; j <= n; j++) {
      if (a[i] == a[j])
        addedge(i, j + n, 1, 0);
      else
        addedge(i, j + n, 1, hf[j]);
    }
  }
  int ans = SpfaFlow();
  int ans1 = n;
  for (int i = n + 1; i <= n + n; i++) {
    for (int j = head[i]; j != -1; j = nex[j]) {
      int v = ver[j];
      if (cost[j] != 0 && flow[j] != 0) {
        ans1++;
        break;
      }
    }
  }
  printf("%d %d\n", ans1, ans);
  for (int i = n + 1; i <= n + n; i++) {
    for (int j = head[i]; j != -1; j = nex[j]) {
      int v = ver[j];
      if (flow[j] != 0) {
        int flag = 1;
        if (cost[j] == 0) {
          flag = 0;
        }
        if (v < dest && v > 2 * n) {
          printf("%c=%d\n", 'a' - 1 + v - 2 * n, a[i - n]);
          printf("print(%c)\n", 'a' - 1 + v - 2 * n);
          aans[v - 2 * n] = a[i - n];
        } else {
          for (int k = 1; k <= m; k++) {
            if (aans[k] == a[v]) {
              if (flag) {
                printf("%c=%d\n", 'a' - 1 + k, a[i - n]);
              }
              printf("print(%c)\n", 'a' - 1 + k);
              aans[k] = a[i - n];
              break;
            }
          }
        }
        break;
      }
    }
  }
  return 0;
}
