#include <bits/stdc++.h>
const int MAX = 605;
const int INF = 1000000000;
const int MOD = 1000000;
struct EDGE {
  int cap, cost, v, next;
} edge[MOD];
int head[MAX], E, q[MOD];
bool used[MAX];
int pre[MAX], cur[MAX], dis[MAX];
void add_edge(int s, int t, int cap, int cost) {
  edge[E].cap = cap;
  edge[E].cost = cost;
  edge[E].next = head[s];
  edge[E].v = t;
  head[s] = E++;
  edge[E].cap = 0;
  edge[E].cost = -cost;
  edge[E].next = head[t];
  edge[E].v = s;
  head[t] = E++;
}
int min(int a, int b) { return (a == -1 || b < a) ? b : a; }
int SPFA(int s, int t, int n) {
  int f = -1, r = 0;
  int i, v;
  q[r] = s;
  for (i = 0; i < n; i++) dis[i] = INF;
  dis[s] = 0;
  pre[s] = s;
  cur[s] = -1;
  memset(used, false, sizeof(bool) * n);
  used[s] = true;
  while (f != r) {
    f++;
    if (f >= MOD) f -= MOD;
    s = q[f];
    used[s] = false;
    for (i = head[s]; i != -1; i = edge[i].next) {
      v = edge[i].v;
      if (edge[i].cap > 0 && dis[s] + edge[i].cost < dis[v]) {
        dis[v] = dis[s] + edge[i].cost;
        pre[v] = s;
        cur[v] = i;
        if (!used[v]) {
          used[v] = true;
          r++;
          if (r >= MOD) r -= MOD;
          q[r] = v;
        }
      }
    }
  }
  return dis[t];
}
int MinCost(int s, int t, int n) {
  int ans = 0;
  int u, v, cap;
  int cost;
  while (1) {
    cost = SPFA(s, t, n);
    if (cost == INF) break;
    u = v = t;
    cap = -1;
    for (u = t; u != s; u = pre[u]) {
      cap = min(cap, edge[cur[u]].cap);
    }
    ans += cost * cap;
    u = v = t;
    for (u = t; u != s; u = pre[u]) {
      edge[cur[u]].cap -= cap;
      edge[cur[u] ^ 1].cap += cap;
    }
  }
  return ans;
}
int in[MAX];
int f[MAX];
int ch[MAX];
bool flag[MAX];
int main() {
  int n, m;
  int i, j, k;
  while (scanf("%d%d", &n, &m) != -1) {
    memset(flag, 0, sizeof(flag));
    for (i = 0; i < n; i++) {
      scanf("%d", &in[i]);
      for (j = 0, f[i] = 0; j < 31; j++)
        if (in[i] & (1 << j)) f[i]++;
    }
    int s = n * 2 + m;
    int t = s + 1;
    E = 0;
    memset(head, -1, sizeof(int) * (t + 1));
    for (i = 0; i < n; i++)
      for (j = i + 1; j < n; j++)
        add_edge(i, j + n, 1, in[i] == in[j] ? 0 : f[j]);
    for (i = 0; i < m; i++)
      for (j = 0; j < n; j++) add_edge(i + n + n, j + n, 1, f[j]);
    for (i = 0; i < n; i++) add_edge(s, i, 1, 0);
    for (i = 0; i < m; i++) add_edge(s, i + n + n, 1, 0);
    for (i = 0; i < n; i++) add_edge(i + n, t, 1, 0);
    int ans = MinCost(s, t, t + 1);
    int len = n, z = 0;
    for (i = 0; i < n; i++)
      for (j = i + 1; j < n; j++, z += 2)
        if (edge[z].cap == 0) {
          if (in[i] == in[j])
            ch[j] = i;
          else
            len++, ch[j] = i, flag[j] = 1;
        }
    for (i = 0; i < m; i++)
      for (j = 0; j < n; j++, z += 2)
        if (edge[z].cap == 0) ch[j] = i + n, len++;
    printf("%d %d\n", len, ans);
    for (i = 0; i < n; i++) {
      char c;
      if (ch[i] >= n) printf("%c=%d\n", ch[i] - n + 'a', in[i]);
      int t = i;
      while (ch[t] < n) t = ch[t];
      c = ch[t] - n + 'a';
      if (flag[i]) printf("%c=%d\n", c, in[i]);
      printf("print(%c)\n", c);
    }
  }
}
