#include <bits/stdc++.h>
const int maxn = 810;
const int maxm = 100010;
const int inf = 100000;
using namespace std;
struct MCMF {
  int src, sink, e, n;
  int first[maxn];
  int cap[maxm], cost[maxm], v[maxm], next[maxm];
  void init() {
    e = 0;
    memset(first, -1, sizeof(first));
  }
  void add_edge(int a, int b, int c, int w) {
    cap[e] = c, cost[e] = w, v[e] = b, next[e] = first[a], first[a] = e++;
    cap[e] = 0, cost[e] = -w, v[e] = a, next[e] = first[b], first[b] = e++;
  }
  int d[maxn], pre[maxn], pos[maxn];
  bool vis[maxn];
  bool spfa(int s, int t) {
    memset(pre, -1, sizeof(pre));
    memset(vis, 0, sizeof(vis));
    queue<int> q;
    for (int i = 0; i <= n; i++) d[i] = inf;
    q.push(s);
    pre[s] = s;
    d[s] = 0;
    vis[s] = 1;
    while (!q.empty()) {
      int u = q.front();
      q.pop();
      vis[u] = 0;
      for (int i = first[u]; i != -1; i = next[i]) {
        if (cap[i] > 0 && d[u] + cost[i] < d[v[i]]) {
          d[v[i]] = d[u] + cost[i];
          pre[v[i]] = u;
          pos[v[i]] = i;
          if (!vis[v[i]]) vis[v[i]] = 1, q.push(v[i]);
        }
      }
    }
    if (d[t] > 0) return 0;
    return pre[t] != -1;
  }
  int Mincost, Maxflow;
  int MincostFlow(int s, int t, int nn) {
    Mincost = 0, Maxflow = 0, n = nn;
    while (spfa(s, t)) {
      int min_f = inf;
      for (int i = t; i != s; i = pre[i])
        if (cap[pos[i]] < min_f) min_f = cap[pos[i]];
      Mincost += d[t] * min_f;
      Maxflow += d[t];
      for (int i = t; i != s; i = pre[i]) {
        cap[pos[i]] -= min_f;
        cap[pos[i] ^ 1] += min_f;
      }
    }
    return Mincost;
  }
} solver;
int bitcount(int x) {
  int ret = 0;
  while (x) {
    if (x & 1) ret++;
    x >>= 1;
  }
  return ret;
}
int a[300], b[300], v[300], res[300], now[300];
int main() {
  int n, m;
  scanf("%d%d", &n, &m);
  int S = 0, T = 3 * n + 1;
  solver.init();
  solver.add_edge(S, 1, m, 0);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    solver.add_edge(i, i + n, 1, bitcount(a[i]));
    solver.add_edge(i + n, i + 2 * n, 1, -inf);
    solver.add_edge(i + 2 * n, T, 1, 0);
    if (i < n) {
      solver.add_edge(i + 2 * n, i + 1, 1, 0);
      solver.add_edge(i, i + 1, inf, 0);
    }
  }
  for (int i = 1, j; i <= n; i++) {
    for (j = i + 1; j <= n && a[i] - a[j]; j++)
      ;
    res[i] = -1;
    if (j <= n)
      res[i] = solver.e, solver.add_edge(i + 2 * n, j + n, 1, 0), v[i] = j;
  }
  int ans1 = solver.MincostFlow(S, T, T), ans2 = n;
  for (int i = 1; i <= n; i++)
    if (res[i] != -1) {
      if (!solver.cap[res[i]]) ans2--;
    }
  printf("%d %d\n", n + ans2, (ans1 % inf + inf) % inf);
  for (int i = 1; i <= n; i++) {
    int w = now[i];
    if (!w) {
      for (w = 97; b[w]; w++)
        ;
      b[w] = 1;
      printf("%c=%d\n", w, a[i]);
    }
    printf("print(%c)\n", w);
    if (res[i] != -1 && !solver.cap[res[i]])
      now[v[i]] = w;
    else
      b[w] = 0;
  }
  return 0;
}
