#include <bits/stdc++.h>
using namespace std;
int lst[100005], to[200005], pre[200005], cap[200005], cost[200005],
    rev[200005], tot;
int dis[100005], prev_e[100005], prev_v[100005], que[100005];
bool in_que[100005];
inline void add_edge(int u, int v, int _cap, int _cost) {
  to[tot] = v;
  pre[tot] = lst[u];
  cap[tot] = _cap;
  cost[tot] = _cost;
  rev[tot] = tot + 1;
  lst[u] = tot++;
  to[tot] = u;
  pre[tot] = lst[v];
  cap[tot] = 0;
  cost[tot] = -_cost;
  rev[tot] = tot - 1;
  lst[v] = tot++;
}
inline int min_cost_max_flow(int s, int t) {
  int res = 0;
  while (true) {
    int he = 0, ta = 1;
    memset(dis, 0x3f, sizeof(dis));
    memset(in_que, false, sizeof(in_que));
    que[0] = s;
    in_que[s] = true;
    dis[s] = 0;
    while (he < ta) {
      int u = que[he++];
      in_que[u] = false;
      for (int i = lst[u]; ~i; i = pre[i]) {
        if (cap[i] && dis[to[i]] > dis[u] + cost[i]) {
          dis[to[i]] = dis[u] + cost[i];
          prev_e[to[i]] = i;
          prev_v[to[i]] = u;
          if (!in_que[to[i]]) {
            in_que[to[i]] = true;
            que[ta++] = to[i];
          }
        }
      }
    }
    if (dis[t] == 0x3f3f3f3f) break;
    int u = t, mx = 1e9;
    while (u != s) {
      mx = min(mx, cap[prev_e[u]]);
      u = prev_v[u];
    }
    if (!mx) break;
    u = t;
    res += mx * dis[t];
    while (u != s) {
      cap[prev_e[u]] -= mx;
      cap[rev[prev_e[u]]] += mx;
      u = prev_v[u];
    }
  }
  return res;
}
int arr[255], idx[255], val[35];
char ans[505][505];
inline int cnt(int x) {
  int res = 0;
  while (x) {
    x &= x - 1;
    res++;
  }
  return res;
}
inline int calc(int x, int y) {
  if (x == y) return 0;
  return cnt(y);
}
int main() {
  memset(lst, -1, sizeof(lst));
  int n, m;
  scanf("%d%d", &n, &m);
  for (int i = 0; i < n; i++) scanf("%d", arr + i);
  for (int i = 0; i < n; i++) {
    add_edge(i + n + 1, n + n + 1, 1, 0);
    add_edge(1, i + n + 1, 1, cnt(arr[i]));
    for (int j = i + 1; j < n; j++)
      add_edge(i + 2, j + n + 1, 1, calc(arr[i], arr[j]));
  }
  add_edge(0, 1, m, 0);
  for (int i = 1; i < n; i++) add_edge(0, i + 1, 1, 0);
  int res = min_cost_max_flow(0, n + n + 1), cur = 0, ans_cnt = 0;
  for (int i = 0; i < n; i++) {
    for (int j = lst[i + n + 1]; ~j; j = pre[j]) {
      if (cap[j] && to[j] < i + n + 1) {
        idx[i] = to[j] == 1 ? cur++ : idx[to[j] - 2];
        break;
      }
    }
    if (val[idx[i]] != arr[i])
      sprintf(ans[ans_cnt++], "%c=%d", idx[i] + 'a', arr[i]);
    val[idx[i]] = arr[i];
    sprintf(ans[ans_cnt++], "print(%c)", idx[i] + 'a');
  }
  printf("%d %d\n", ans_cnt, res);
  for (int i = 0; i < ans_cnt; i++) puts(ans[i]);
  return 0;
}
