#include <bits/stdc++.h>
using namespace std;
const int N = 2e6 + 5;
const int inf = ~0U >> 1;
template <class U, class V>
struct MCMF {
  static const int N = 6000, M = 201010;
  int h[N], ing[N], pre[N], to[M], ne[M], e, s, t, n;
  U cap[M];
  V dis[N], cost[M];
  void ini(int _n = N) {
    fill(h, h + (n = _n), -1);
    e = 0;
  }
  void liu(int u, int v, U c, V w) {
    to[e] = v;
    ne[e] = h[u];
    cap[e] = c;
    cost[e] = w;
    h[u] = e++;
  }
  void link(int u, int v, U c, V w) {
    liu(u, v, c, w);
    liu(v, u, 0, -w);
  }
  bool spfa() {
    queue<int> Q;
    fill(dis, dis + n, inf);
    Q.push(s), ing[s] = 1, dis[s] = 0;
    while (!Q.empty()) {
      int c = Q.front();
      Q.pop();
      ing[c] = 0;
      for (int k = h[c]; ~k; k = ne[k])
        if (cap[k] > 0) {
          int v = to[k];
          if (dis[c] + cost[k] < dis[v]) {
            dis[v] = dis[c] + cost[k];
            pre[v] = k;
            if (!ing[v]) Q.push(v), ing[v] = 1;
          }
        }
    }
    return dis[t] != inf;
  }
  U flow;
  V mincost;
  pair<U, V> run(int _s, int _t) {
    s = _s, t = _t;
    flow = mincost = 0;
    while (spfa()) {
      U pl = inf;
      int p, k;
      for (p = t; p != s; p = to[k ^ 1]) pl = min(pl, cap[k = pre[p]]);
      for (p = t; p != s; p = to[k ^ 1])
        cap[k = pre[p]] -= pl, cap[k ^ 1] += pl;
      mincost += pl * dis[t];
      flow += pl;
    }
    return make_pair(flow, mincost);
  }
};
MCMF<int, int> flow;
int n, m;
int c[N], a[N];
int pre[N], nx[N], ans[N];
bool vis[N];
int main() {
  cin >> n >> m;
  for (int i = (1); i < (n + 1); i++) {
    int x;
    cin >> a[i];
    x = a[i];
    while (x) {
      if (x & 1) c[i]++;
      x /= 2;
    }
  }
  int s = 0, t = 5000;
  flow.ini();
  int mn = -1e6;
  for (int i = (1); i < (n + 1); i++) {
    flow.link(i - 1, i, m, 0);
    flow.link(i, i + n, 1, c[i]);
    flow.link(i + n, i + 2 * n, 1, mn);
    int nx = i + 1;
    if (nx == n + 1) nx = t;
    flow.link(i + 2 * n, nx, 1, 0);
    for (int j = (i + 1); j < (n + 1); j++) {
      if (a[i] == a[j]) {
        flow.link(i + 2 * n, j + n, 1, 0);
        break;
      }
    }
  }
  flow.link(n, t, m, 0);
  int cost = flow.run(s, t).second - n * mn, cc = n;
  for (int i = (1); i < (n + 1); i++) {
    for (int k = flow.h[i + n]; k != -1; k = flow.ne[k]) {
      if (flow.cap[k] == 1) {
        if (flow.to[k] == i)
          pre[i] = -1, cc++;
        else
          pre[i] = flow.to[k] - 2 * n, nx[flow.to[k] - 2 * n] = i;
      }
    }
  }
  cout << cc << " " << cost << "\n";
  for (int i = (1); i < (n + 1); i++) {
    if (pre[i] == -1) {
      int pos;
      for (int j = (0); j < (m); j++)
        if (!vis[j]) {
          pos = j;
          break;
        }
      char c = 'a' + pos;
      cout << c << "=" << a[i] << "\n";
      cout << "print(" << c << ")\n";
      ans[i] = pos;
      if (nx[i]) vis[pos] = true;
    } else {
      char c = 'a' + ans[pre[i]];
      cout << "print(" << c << ")\n";
      ans[i] = ans[pre[i]];
      if (!nx[i]) vis[ans[i]] = false;
    }
  }
  return 0;
}
