#include <bits/stdc++.h>
using namespace std;
struct Edge {
  int idx, f, w;
  Edge* next;
  Edge* opp;
};
Edge adj[605], memo[605 * 605];
int f[600], a[600];
int n, m, s, t;
int mset, ans;
int dist[605];
Edge* pre[605];
int top, mark[600], last[600];
char ret[1010][30];
void addEdgeProcess(int a, int b, int c, int w) {
  Edge* ptr = &memo[mset++];
  ptr->idx = b;
  ptr->f = c;
  ptr->w = w;
  ptr->next = adj[a].next;
  adj[a].next = ptr;
}
void addEdge(int a, int b, int c, int w) {
  addEdgeProcess(a, b, c, w);
  addEdgeProcess(b, a, 0, -w);
  adj[a].next->opp = &memo[mset - 1];
  adj[b].next->opp = &memo[mset - 2];
}
bool spfa() {
  for (int i = s; i <= t; ++i) dist[i] = 1000000000;
  dist[s] = 0;
  bool flag = 1;
  for (int x = s; x < t && flag; ++x) {
    flag = 0;
    for (int i = s; i <= t; ++i) {
      Edge* ptr = adj[i].next;
      while (ptr) {
        if (ptr->f <= 0) {
          ptr = ptr->next;
          continue;
        }
        int k = ptr->idx;
        if (dist[i] + ptr->w < dist[k]) {
          dist[k] = dist[i] + ptr->w;
          pre[k] = ptr;
          flag = 1;
        }
        ptr = ptr->next;
      }
    }
  }
  return (dist[t] < 1000000000);
}
void add_Path() {
  int k = t, Min = 1000000000;
  Edge* ptr;
  while (k != s) {
    ptr = pre[k];
    if (ptr->f < Min) Min = ptr->f;
    k = ptr->opp->idx;
  }
  k = t;
  while (k != s) {
    ptr = pre[k];
    ptr->f -= Min;
    ptr->opp->f += Min;
    k = ptr->opp->idx;
  }
  ans += Min * dist[t];
}
void solve() {
  ans = 0;
  while (spfa()) {
    add_Path();
  }
  top = 0;
  memset(mark, -1, sizeof mark);
  memset(last, -1, sizeof last);
  for (int i = 1; i <= m; ++i) {
    for (Edge* ptr = adj[i + n].next; ptr; ptr = ptr->next) {
      if (ptr->idx == s) continue;
      int k = ptr->idx - n - m;
      if (ptr->opp->f) {
        mark[k] = i;
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    for (Edge* ptr = adj[i].next; ptr; ptr = ptr->next) {
      if (ptr->idx == s) continue;
      int k = ptr->idx - n - m;
      if (ptr->opp->f) {
        mark[k] = mark[i];
      }
    }
  }
  for (int i = 1; i <= n; ++i) {
    char ch = 'a' + mark[i] - 1;
    if (last[mark[i]] != a[i]) {
      sprintf(ret[top++], "%c=%d\n", ch, a[i]);
    }
    sprintf(ret[top++], "print(%c)\n", ch);
    last[mark[i]] = a[i];
  }
  printf("%d %d\n", top, ans);
  for (int i = 0; i < top; ++i) printf("%s", ret[i]);
}
void init() {
  s = 0, t = m + 2 * n + 1;
  mset = 0;
  for (int i = s; i <= t; ++i) adj[i].next = NULL;
  for (int i = 1; i < n; ++i) {
    for (int j = i + 1; j <= n; ++j) {
      if (a[i] == a[j])
        addEdge(i, j + n + m, 1, 0);
      else
        addEdge(i, j + n + m, 1, f[j]);
    }
  }
  for (int i = 1; i <= m; ++i) {
    for (int j = 1; j <= n; ++j) {
      addEdge(i + n, j + n + m, 1, f[j]);
    }
  }
  for (int i = 1; i <= n + m; ++i) addEdge(s, i, 1, 0);
  for (int i = 1; i <= n; ++i) addEdge(i + n + m, t, 1, 0);
}
int calc(int n) {
  if (n == 0) return 0;
  int ans = 0;
  for (; n; n -= (n & -n)) ans++;
  return ans;
}
int main() {
  while (scanf("%d%d", &n, &m) != EOF) {
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &a[i]);
      f[i] = calc(a[i]);
    }
    init();
    solve();
  }
  return 0;
}
