#include <bits/stdc++.h>
using namespace std;
const int maxn = 601;
const int inf = 1 << 30;
struct edge {
  int v, w, c, rev;
  edge() {}
  edge(int v, int w, int c, int rev) : v(v), w(w), c(c), rev(rev) {}
};
vector<edge> adj[maxn];
pair<int, int> p[maxn];
int dis[maxn];
int extra[maxn];
int a[maxn];
int cst[maxn];
int pos[maxn][maxn];
int pst[maxn];
int vis[maxn];
bool f[maxn];
int spfa(int s, int t);
int ek(int s, int t);
void add(int u, int v, int w, int c);
void add(int u, int v, int l, int r, int c);
int val(int x);
int main() {
  int n, m;
  int s, t, S, T, r;
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    cst[i] = val(a[i]);
  }
  S = 0;
  T = 2 * n + 4;
  s = 1;
  t = 2 * n + 3;
  r = 2 * n + 2;
  add(s, r, m, 0);
  for (int i = 1; i <= n; i++) {
    int u = 2 * i;
    int v = 2 * i + 1;
    add(r, u, 1, cst[i]);
    add(u, v, 1, 1, 0);
    add(v, t, 1, 0);
    for (int j = i + 1; j <= n; j++) {
      int u1 = 2 * j;
      if (a[i] == a[j])
        add(v, u1, 1, 0);
      else
        add(v, u1, 1, cst[j]);
      pos[i][j] = adj[v].size() - 1;
    }
  }
  add(t, s, inf, 0);
  for (int i = 1; i <= n; i++) {
    int u = 2 * i;
    int v = 2 * i + 1;
    add(u, T, -extra[u], 0);
    add(S, v, extra[v], 0);
  }
  int cost = ek(S, T);
  for (int i = 1; i <= n; i++) {
    int v = 2 * i + 1;
    for (int j = i + 1; j <= n; j++) {
      if (!adj[v][pos[i][j]].w) {
        pst[i] = j;
      }
    }
  }
  int cnt = 0;
  int line = n;
  for (int i = 1; i <= n; i++) {
    if (vis[i]) continue;
    f[i] = 1;
    vis[i] = ++cnt;
    int last = i;
    int cur = pst[i];
    line++;
    while (cur) {
      if (a[cur] != a[last]) line++;
      vis[cur] = vis[i];
      last = cur;
      cur = pst[cur];
    }
  }
  printf("%d %d\n", line, cost);
  for (int i = 1; i <= n; i++) {
    if (!f[i]) continue;
    char key = 'a' + vis[i] - 1;
    printf("%c=%d\n", key, a[i]);
  }
  for (int i = 1; i <= n; i++) {
    char key = 'a' + vis[i] - 1;
    printf("print(%c)\n", key);
    if (pst[i] && a[i] != a[pst[i]]) {
      printf("%c=%d\n", key, a[pst[i]]);
    }
  }
  return 0;
}
int spfa(int s, int t) {
  for (int i = s; i <= t; i++) {
    dis[i] = inf;
  }
  dis[s] = 0;
  queue<int> q;
  q.push(s);
  while (!q.empty()) {
    int u = q.front();
    q.pop();
    for (int i = 0; i < adj[u].size(); i++) {
      int v = adj[u][i].v;
      int w = adj[u][i].w;
      int c = adj[u][i].c;
      if (w <= 0) continue;
      if (dis[v] <= dis[u] + c) continue;
      dis[v] = dis[u] + c;
      q.push(v);
      p[v] = make_pair(u, i);
    }
  }
  if (dis[t] == inf) return 0;
  int cur = t;
  int flow = inf;
  while (cur != s) {
    int u = p[cur].first;
    int i = p[cur].second;
    flow = min(flow, adj[u][i].w);
    cur = u;
  }
  cur = t;
  while (cur != s) {
    int u = p[cur].first;
    int i = p[cur].second;
    int rev = adj[u][i].rev;
    adj[u][i].w -= flow;
    adj[cur][rev].w += flow;
    cur = u;
  }
  return flow;
}
int ek(int s, int t) {
  int cost = 0;
  int flow = 0;
  while (int df = spfa(s, t)) {
    flow += df;
    cost += df * dis[t];
  }
  return cost;
}
void add(int u, int v, int w, int c) {
  adj[u].push_back(edge(v, w, c, adj[v].size()));
  adj[v].push_back(edge(u, 0, -c, adj[u].size() - 1));
}
void add(int u, int v, int l, int r, int c) {
  if (r - l) add(u, v, r - l, c);
  extra[u] -= l;
  extra[v] += l;
}
int val(int x) {
  int ret = 0;
  for (int i = 0; i <= 30; i++) {
    if ((x >> i) & 1) ret++;
  }
  return ret;
}
