jiahuimbzuai/CoQuIR huggingface dataset:
//  [python]

N, M = map(int, input().split())

dp = [[0 for i in range(N)] for j in range(N)]

for i in range(M):
    a, b = map(int, input().split())
    dp[a-1][b-1] += 1
    dp[b-1][a-1] += 1
    
for i in range(N):
    print(sum(dp[i]))
//  [python]
n,m = map(int,input().split())
AB = [list(map(int,input().split())) for i in range(m)]
l = [0 for i in range(n)]
for i in range(m):
    l[AB[i][0]-1]+=1
    l[AB[i][1]-1]+=1
for i in range(n):
    print(l[i])
//  [python]
N, M = map(int, input().split())

l = []
for m in range(M):
    l += input().split()

for n in range(N):
    print(l.count(str(n+1)))
//  [python]

# coding: utf-8
import numpy as np

if __name__ == "__main__":
	n, m = map(int, input().split())

	mat = [[0]*n for _ in range(n)]
	for _ in range(m):
		a, b = map(int, input().split())
		a -= 1; b -= 1
		mat[a][b] += 1
		mat[b][a] += 1

	for i in range(n):
		print(sum(mat[i]))
//  [python]
import numpy as np
N,M = map(int, input().split())

a = np.zeros(M)
b = np.zeros(M)
for i in range(M):
  a[i],b[i] = map(int, input().split())
  
for i in range(1,N+1):
  print((a==i).sum() + (b==i).sum())
//  [python]
if __name__ == '__main__':
    from numpy import zeros
    N, M = map(int, input().split())
    city = zeros(2*M, dtype='int32')
    for i in range(M):
        city[2*i:2*i+2] = list(map(int, input().split()))
    ans = zeros(N+1, dtype='int32')
    for j in city:
        ans[j] += 1
    for i in range(1, N+1):
        print(ans[i])
//  [java]
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;

public class Main {

	public static void main(String[] args) throws IOException {
		BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
		try{
			String str = br.readLine();
			String[] st = str.split(" ",0);
			int N =  Integer.parseInt(st[0]);
			int M = Integer.parseInt(st[1]);
			int[] count = new int[N];
			Arrays.fill(count,0);
			for(int i = 0;i <M;i++){
				str = br.readLine();
				st = str.split(" ",0);
				int a =  Integer.parseInt(st[0]);
				int b = Integer.parseInt(st[1]);
				count[a-1]++;
				count[b-1]++;
			}
			for(int i = 0; i < N ;i++){
				System.out.println(count[i]);
			}
		}catch(Exception ex){
			System.exit(0);
		}
	}
}
//  [java]
import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

public class Main {

	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int N = sc.nextInt();
		int M = sc.nextInt();
		int[] a = new int[M];
		int[] b = new int[M];
		sc.fill(a, b);

		Map<Integer, Integer> map = new HashMap<>();
		for (int i = 0; i < N; i++) {
			map.put(i + 1, 0);
		}

		for (int i = 0; i < M; i++) {
			map.put(a[i], map.get(a[i]) + 1);
			map.put(b[i], map.get(b[i]) + 1);
		}

		StringBuilder sb = new StringBuilder();
		for (int i = 0; i < N; i++) {
			sb.append(map.get(i + 1)).append(System.lineSeparator());
		}

		System.out.print(sb.toString());
	}

	private static boolean isDebug = System.getProperty("sun.desktop") != null;

	private static void debug(Object... o) {
		if (isDebug) {
			System.err.println(Arrays.deepToString(o));
		}
	}

	public static class Scanner {
		private BufferedInputStream inputStream;

		public Scanner(InputStream in) {
			inputStream = new BufferedInputStream(in);
		}

		public int nextInt() throws IOException {
			int num = 0;
			int sign = 1;

			int read = skip();
			if (read == '-') {
				sign = -1;
				read = inputStream.read();
			}

			do {
				num = num * 10 + sign * (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(int[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
			}
		}

		public void fill(int[] a, int[] b, int[] c) throws IOException {
			if (a.length != b.length || b.length != c.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextInt();
				b[i] = nextInt();
				c[i] = nextInt();
			}
		}

		public long nextLong() throws IOException {
			long num = 0;

			int read = skip();
			do {
				num = num * 10 + (read - 0x30);
			} while ((read = inputStream.read()) > 0x20);

			return num;
		}

		public void fill(long[] a) throws IOException {
			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
			}
		}

		public void fill(long[] a, long[] b) throws IOException {
			if (a.length != b.length) {
				throw new IllegalArgumentException();
			}

			for (int i = 0; i < a.length; i++) {
				a[i] = nextLong();
				b[i] = nextLong();
			}
		}

		public long[] nextLong(int n) throws IOException {
			long[] array = new long[n];
			for (int i = 0; i < n; i++) {
				array[i] = nextLong();
			}

			return array;
		}

		public String next() throws IOException {
			StringBuilder builder = new StringBuilder();

			int read = skip();
			do {
				builder.append((char) read);
			} while ((read = inputStream.read()) > 0x20);

			return builder.toString();
		}

		private int skip() throws IOException {
			int read;
			while ((read = inputStream.read()) <= 0x20)
				;

			return read;
		}
	}
}
//  [java]
import java.io.OutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.stream.IntStream;
import java.util.StringTokenizer;
import java.io.IOException;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.InputStream;

/**
 * Built using CHelper plug-in
 * Actual solution is at the top
 */
public class Main {
    public static void main(String[] args) {
        InputStream inputStream = System.in;
        OutputStream outputStream = System.out;
        MyScanner in = new MyScanner(inputStream);
        PrintWriter out = new PrintWriter(outputStream);
        B solver = new B();
        solver.solve(1, in, out);
        out.close();
    }

    static class B {
        public void solve(int testNumber, MyScanner in, PrintWriter out) {
            int N = in.Int();
            int M = in.Int();
            int[] cnt = new int[N];
            for (int i = 0; i < M; i++) {
                int a = in.Int() - 1;
                int b = in.Int() - 1;
                cnt[a]++;
                cnt[b]++;
            }
            IntStream.of(cnt).forEach(out::println);
        }

    }

    static class MyScanner {
        private BufferedReader in;
        private StringTokenizer st;

        public MyScanner(InputStream stream) {
            in = new BufferedReader(new InputStreamReader(stream));
        }

        public String next() {
            while (st == null || !st.hasMoreTokens()) {
                try {
                    String rl = in.readLine();
                    if (rl == null) {
                        return null;
                    }
                    st = new StringTokenizer(rl);
                } catch (IOException e) {
                    return null;
                }
            }
            return st.nextToken();
        }

        public int Int() {
            return Integer.parseInt(next());
        }

    }
}
//  [java]
import java.util.Arrays;
import java.util.Scanner;
import java.util.Spliterator;
import java.util.Spliterators;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

public class Main{
	static final Scanner s=new Scanner(System.in);
	static final long[] fal_rnd(int size){
		AtomicInteger l=new AtomicInteger(-1),r=new AtomicInteger(size);
		long[] res=new long[size];
		INS(size).unordered().parallel().mapToLong(Long::parseLong).forEach(v->res[ThreadLocalRandom.current().nextBoolean()?l.incrementAndGet():r.decrementAndGet()]=v);
		return res;
	}
	static final IntStream REPS(int v){
		return IntStream.range(0,v);
	}
	static final Stream<String> INS(long size){
		return StreamSupport.stream(Spliterators.spliterator(s,size,Spliterator.NONNULL&Spliterator.IMMUTABLE),false).limit(size);
	}
	public static void main(String[]__){
		int n=s.nextInt(),m=s.nextInt();
		int[][] ar=new int[n][n];
		for(int i=0;i<m;i++) {
			int a=s.nextInt()-1,b=s.nextInt()-1;
			ar[a][b]++;
			ar[b][a]++;
		}
		Arrays.stream(ar).mapToInt(i->Arrays.stream(i).sum()).forEach(System.out::println);
	}
}
//  [java]
import java.util.Arrays;
import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		try {
			int n = sc.nextInt();
			int m = sc.nextInt();
			sc.nextLine();

			int[] ab = new int[n];
			Arrays.fill(ab, 0);
			int ai = 0;
			int bi = 0;
			for (int i = 0; i < m; i++) {
				ai = sc.nextInt();
				ab[ai - 1]++;
				bi = sc.nextInt();
				ab[bi - 1]++;
				sc.nextLine();
			}

			Arrays.stream(ab).forEach(i -> System.out.println(i));

		} finally {
			sc.close();
		}
	}
}
//  [cpp]
#include <cstdio>
#include <cstring>
const int MaxN = 1e5;
using namespace std;

int ind[MaxN + 5];
int n , m;
int main()
{
	while(~scanf("%d%d" , &n, &m)){
		for(int i = 1;i <= m;i++){
			int u ,  v;
			scanf("%d%d" , &u , &v);
			ind[u]++;
			ind[v]++;
		}
		for(int i = 1;i <= n;i++){
			printf("%d\n" , ind[i]);
		}
	}
}
//  [cpp]
#include<cstdio>
#include<cstring>
#include<cmath>
#include<cstdlib>
#include<algorithm>
using namespace std;
int n, m;
int cnt[55];
int main(){
	while(~scanf("%d %d", &n, &m)){
		for(int i = 1; i <= m; i++){
			int u, v;
			scanf("%d %d", &u, &v);
			cnt[u]++;
			cnt[v]++;
		}
		for(int i = 1; i <= n; i++)
			printf("%d\n", cnt[i]);
		memset(cnt, 0, sizeof(cnt));
	}
	return 0;
}
//  [cpp]
#include <cstdio>
#define maxn 60
using namespace std;
int ans[maxn],n,m;
int main() {
	scanf("%d %d",&n,&m);
	for (int i=1;i<=m;i++) {
		int a,b;
		scanf("%d %d",&a,&b);
		ans[a]++;
		ans[b]++;
	}
	for (int i=1;i<=n;i++)
		printf("%d\n",ans[i]);
	return 0;
}
//  [cpp]
#include<iostream>
#include <string> // string, to_string, stoi
#include <vector> // vector
#include <algorithm> // min, max, swap, sort, reverse, lower_bound, upper_bound
#include <utility> // pair, make_pair
#include <tuple> // tuple, make_tuple
#include <cstdint> // int64_t, int*_t
#include <cstdio> // printf
#include <map> // map
#include <queue> // queue, priority_queue
#include <set> // set
#include <stack> // stack
#include <deque> // deque
#include <unordered_map> // unordered_map
#include <unordered_set> // unordered_set
#include <bitset> // bitset
#include <cctype> // isupper, islower, isdigit, toupper, tolower
#include <iomanip>//setprecision
#include<math.h>
#include <functional>
#include<climits>
using namespace std;
#define ll  long long 
#define rep(i, n)        for(ll i=0; i<(ll)(n); ++i)
#define mod 1000000007
  vector<ll>to[1000005];
   ll dp[2000000];
 int gcd(int a, int b)
{
  if (a%b == 0)
{
return(b);
}
else
{
return(gcd(b,a%b));
}
}
int main(){
  ll a,b,c;cin>>a>>b;
  vector<ll>d(a,0);
  rep(i,b){
    cin>>c;
    d[c-1]++;
    cin>>c;
    d[c-1]++;    
  }
  rep(i,a)cout<<d[i]<<endl;
}
//  [cpp]
#include <bits/stdc++.h>
using namespace std;
#define SPEED ios::sync_with_stdio(false); cin.tie(0); cout.tie(0)
#define int long long
#define ld long double
#define fi first
#define se second
#define all(uiet) uiet.begin(),uiet.end()
#define read(UIET) for(int i = 0; i < n; ++i) cin >> UIET[i]
#define out(UIET) for(int i = 0; i < n; ++i) cout << UIET[i]
#define mp make_pair
#define pb push_back
#define eb emplace_back
#define vpp vector<pair< int, int > >
#define pll pair<int , int >
#define ppll pair < pll , pll >
#define debug(n1) cout << n1 << endl
#define len(a) ((int) (a).size())
#define endl "\n"
#define mod 1000000007
const int INF=(1LL<<60)-1;
const int MAXN = 1000001;
vector<int> adj[MAXN];
int power(int x, int y, int p = mod){ 
    int res = 1; 
    x = x % p; 
    if (x == 0) return 0; 
    while (y > 0) {  
        if (y & 1) res = (res*x) % p; 
        y = y >> 1;
        x = (x * x) % p;   
    } 
    return res; 
} 
int modFact(int n, int p = mod) 
{ 
    if (n >= p) 
        return 0; 
  
    int result = 1; 
    for (int i = 1; i <= n; i++) 
        result = (result * i) % p; 
  
    return result; 
} 
int32_t main(){
    SPEED;
    int n, m;
    cin >> n >> m;
    for(int i = 0; i < m; ++i){
        int u, v;
        cin >> u >> v;
        adj[u].pb(v);
        adj[v].pb(u);
    }
    for(int i = 1; i <= n; ++i){
        cout << adj[i].size() << endl;
    }
}
// check indices of loop
// check for overflow
//  [cpp]
#include <iostream>
#include <vector>

int main()
{
    int n, m;
    std::cin >> n >> m;
    std::vector<int> vi(n);
    for (auto i = 0; i < m; ++i)
    {
        int a, b;
        std::cin >> a >> b;
        ++vi[a - 1];
        ++vi[b - 1];
    }
    for (auto v : vi)
    {
        std::cout << v << "\n";
    }
    return 0;
}
//  [c]
#include<stdio.h>
int ans[50];
int main(int argc, char const *argv[]){
	int n,m,a,b,i;
	scanf("%d %d",&n,&m);
	for(i=0;i<m;i++){
		scanf("%d %d",&a,&b);
		ans[a-1]++;
		ans[b-1]++;
	}
	for(i=0;i<n;i++){
		printf("%d\n",ans[i]);
	}
	return 0;
}
//  [c]
#include <stdio.h>

int main(void)
{
	int n[50], m[50];
	int tosi, douro, i, j, k, num;
	
	k = scanf("%d %d", &tosi, &douro);
	for(i = 0; i < douro; i++){
		k = scanf("%d %d", &n[i], &m[i]);
	}
	for(j = 1; j <= tosi; j++){
		num = 0;
		for(i = 0; i < douro; i++){
			if((n[i] == j) || (m[i] == j)){
				num++;
			}
		}
		if (j != tosi){
			printf("%d\n", num);
		}
	}
	printf("%d", num);
	return 0;	
}
//  [c]
#include <stdio.h>

int main(void)
{
    int n, m, a, b, i, c[50];

    scanf("%d %d", &n, &m);
    for (i = 0; i < n; i++) {
        c[i] = 0;
    }
    for (i = 0; i < m; i++) {
        scanf("%d %d", &a, &b);
        c[a - 1]++;
        c[b - 1]++;
    }
    for (i = 0; i < n; i++) {
        printf("%d\n", c[i]);
    }
    return 0;
}
//  [c]
#include <stdio.h>
int main(){
  int a,b,n,m,tmp[50+1]={0};
  scanf("%d%d",&n,&m);
  for(int i=0; i<m; i++){
    scanf("%d%d",&a,&b);
    tmp[a-1]++;
    tmp[b-1]++;
  }
  for(int i=0; i<n; i++){
    printf("%d\n",tmp[i]);
  }
  return 0;
}
//  [c]
r[55];s;a;p;main(i){for(;~scanf("%d",&p+!s+!a)?++r[p]:s/i&&printf("%d ",r[i++]););}
//  [c]
#include <stdio.h>

int main(void){
    int n, m, a[51], b[51], count[51]={0};
    scanf("%d%d", &n, &m);
    for(int i=0; i<m; i++) scanf("%d%d", &a[i], &b[i]);
    for(int i=0; i<m; i++) count[a[i]]++, count[b[i]]++;
    for(int i=1; i<=n; i++) printf("%d\n", count[i]);
    return 0;
}
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
    input = input.split("\n");
    var line = input[0].split(" ");
    var num_town = parseInt(line[0]);
    var num_road = parseInt(line[1]);

    var ans = [];


    var first = 0;
    var second = 0;

    for(var i =0; i<num_town;i++){
        ans[i] = 0;
    }

    for(var i =0; i<num_road;i++){
        var temp = input[i+1].split(" ");
//        console.log(temp);
        first = parseInt(temp[0]);
        second = parseInt(temp[1]);
        
        ans[first-1]++;
        ans[second-1]++;
    }

    for(var i =0; i<num_town;i++){
        console.log(ans[i]);
    }
    
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
function myin(){return require("fs").readFileSync("/dev/stdin", "utf8").trim();}
function myout(t){console.log(t);}//standard output
//[no]param
//0:何もしない  1:数値へ変換  2:半角SPで分割  3:改行で分割  4:半角SPで分割し、数値配列へ
//5:改行で分割し、数値配列へ  6:1文字に分割  7:1文字に分割し、数値配列へ
function myconv(i,no){switch(no){case 0:return i;case 1:return parseInt(i);case 2:return i.split(" ");case 3:return i.split("\n");case 4:return i.split(" ").map((a)=>Number(a));case 5:return i.split("\n").map((a)=>Number(a));case 6:return i.split("");case 7:return i.split("").map((a)=>Number(a));}}

function Main(input) {
  input = myconv(input,3);
  var N = myconv(input[0],4)[0];
  var M = myconv(input[0],4)[1];
  input.shift();
  var list = new Array(N).fill(0);
  for(var i = 0; i < M; i++){
    var tmp = myconv(input[i],4);
    list[tmp[0]-1]++;
    list[tmp[1]-1]++;
  }
  myout(list.join("\n"));
}

Main(myin());
//  [javascript]
'use strict'

function main(s) {
  s = s.split('\n');

  const city  = Number(s[0].split(' ')[0]);
  const roads = [];

  s.slice(1, -1).forEach((road) => {
    road = road.split(' ');
    roads.push(road[0]);
    roads.push(road[1]);
  });

  const ans = [...Array(city)].fill(0);
  for (const r of roads) {
    ans[Number(r) - 1] += 1;
  }

  console.log(ans.join('\n'));
}

main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// inputに入力データ全体が入る
function Main(input) {
	// 1行目がinput[0], 2行目がinput[1], …に入る
	input = input.split("\n");
	tmp = input[0].split(" ");
	//文字列から10進数に変換するときはparseIntを使います
	var N = parseInt(tmp[0], 10);
	var M = parseInt(tmp[1], 10);
	var A = [];
	var box = [];
	var ans = 0 ;
	for (var i = 0; i < M; i++) {
		base = input[i+1].split(" ");
		base1 = parseInt(base[0], 10);
		base2 = parseInt(base[1], 10);
		A.push(base1);
		A.push(base2);
	}

	for (var k = 0; k < N; k++) {
		for(var i = 0, s = A, c = 0; i < s.length; i++) c += (s[i] === k+1); // 4
		console.log('%d',c);
	}
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
// https://atcoder.jp/contests/abc061/tasks/abc061_b
"use strict";
function Main(input) {
  const [a, ...b] = input.trim().split("\n");
  const [N, M] = a.trim().split(" ").map(Number);
  const c = b.flatMap((a) => a.trim().split(" "));

  for (let i = 1; i <= N; i++) {
    const d = c.filter((d) => Number(d) === i);
    console.log(d.length);
  }
}
//*この行以降は編集しないでください（標準入出力から一度に読み込み、Mainを呼び出します）
Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [javascript]
'use strict'

main()

function main (input) {
  readInput()
  .then(parseInput)
  .then(calc)
}

function calc (input) {
  let n = input[0][0]
  let m = input[0][1]
  let a = [0]
  let b = [0]
  for (let i = 1; i <= m; i++) {
    a[i] = input[i][0]
    b[i] = input[i][1]
  }
  let cities = new Array(n + 1).fill(0)
  for (let i = 1; i <= m; i++) {
    cities[a[i]]++
    cities[b[i]]++
  }
  for (let i = 1; i <= n; i++) {
    console.log(cities[i])
  }
}

function parseInput (inputRaw) {
  let input = inputRaw.split('\n').map(row => row.split(' ').map(Number))
  return input
}

function readInput () {
  return new Promise((resolve) => {
    let inputArr = []
    process.stdin.resume()
    process.stdin.setEncoding('utf8')
    process.stdin.on('data', (chunk) => {
      inputArr.push(chunk)
    })
    process.stdin.on('end', () => {
      let input = inputArr.join('').trim()
      resolve(input)
    })
  })
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"math"
	"os"
	"strconv"
)

//Util
func nextStr() string {
	sc.Scan()
	return sc.Text()
}

func nextInt() int {
	sc.Scan()
	i, e := strconv.Atoi(sc.Text())
	if e != nil {
		panic(e)
	}
	return i
}

func maxInt(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}

func minInt(a, b int) int {
	if a > b {
		return b
	} else {
		return a
	}
}

func absInt(a int) int {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func absFloat64(a float64) float64 {
	if a >= 0 {
		return a
	} else {
		return -a
	}
}

func maxFloat64(a, b float64) float64 {
	if a > b {
		return a
	} else {
		return b
	}
}

func minFloat64(a, b float64) float64 {
	if a > b {
		return b
	} else {
		return a
	}
}

func str2Int(s string) int {
	n, _ := strconv.Atoi(s)
	return n
}

func reverse(s string) string {
	runes := []rune(s)
	for i, j := 0, len(runes)-1; i < j; i, j = i+1, j-1 {
		runes[i], runes[j] = runes[j], runes[i]
	}
	return string(runes)
}

func pow(p, q int) int {
	return int(math.Pow(float64(p), float64(q)))
}

func isPrime(x int) bool {
	if x == 1 {
		return false
	}
	if x == 2 {
		return true
	}
	if x%2 == 0 {
		return false
	}

	b := true
	rootx := int(math.Sqrt(float64(x)))
	i := 3
	for i <= rootx {
		if x%i == 0 {
			b = false
			break
		}
		i += 2
	}
	return b
}

func PrimeFactors(n int) (pfs []int) {
	// Get the number of 2s that divide n
	for n%2 == 0 {
		pfs = append(pfs, 2)
		n = n / 2
	}

	// n must be odd at this point. so we can skip one element
	// (note i = i + 2)
	for i := 3; i*i <= n; i = i + 2 {
		// while i divides n, append i and divide n
		for n%i == 0 {
			pfs = append(pfs, i)
			n = n / i
		}
	}

	// This condition is to handle the case when n is a prime number
	// greater than 2
	if n > 2 {
		pfs = append(pfs, n)
	}

	return
}

func sumInts(x []int) int {

	total := 0
	for _, v := range x {
		total += v
	}

	return total
}

//Main
const (
	initialBufSize = 10000
	maxBufSize     = 1000000
	mod            = 1e9 + 7
)

var (
	sc *bufio.Scanner = func() *bufio.Scanner {
		sc := bufio.NewScanner(os.Stdin)
		buf := make([]byte, initialBufSize)
		sc.Buffer(buf, maxBufSize)
		return sc
	}()
)

var N, M int

func main() {
	sc.Split(bufio.ScanWords)

	N, M = nextInt(), nextInt()
	m := make(map[int]int, N)
	// for i := 0; i < N; i++ {
	// 	m[i] = 0
	// }

	var a, b int
	for i := 0; i < M; i++ {
		a, b = nextInt()-1, nextInt()-1
		m[a]++
		m[b]++
	}

	for i := 0; i < N; i++ {
		fmt.Println(m[i])
	}

}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n, m int
	fmt.Scan(&n, &m)

	listA := make([]int, m)
	listB := make([]int, m)
	for i := 0; i < m; i++ {
		fmt.Scan(&listA[i], &listB[i])
	}
	listC := make([]int, n)
	for i := 0; i < m; i++ {
		listC[listA[i]-1]++
		listC[listB[i]-1]++
	}
	for i := 0; i < n; i++ {

		fmt.Println(listC[i])
	}

}
//  [go]
package main

import (
	"fmt"
)

func main() {
	var n,m int
	fmt.Scan(&n,&m)
	
	cities := make([]int, n)
	
	a,b := 0,0
	for i := 0; i < m; i++ {
		fmt.Scan(&a,&b)
		cities[a-1]++
		cities[b-1]++
	}
	for i := 0; i < n; i++ {
		fmt.Println(cities[i])
	}
}
//  [go]
package main

import "fmt"

func main() {
	// Code for B - Counting Roads
	var N, M int
	fmt.Scanf("%d %d", &N, &M)
	var a, b int
	city := make(map[int]int, N)
	for i := 0; i < M; i++ {
		fmt.Scanf("%d %d", &a, &b)
		city[a]++
		city[b]++
	}

	for i := 1; i <= N; i++ {
		fmt.Println(city[i])
	}
}
//  [go]
package main

import (
	"bufio"
	"fmt"
	"io"
	"os"
	"strconv"
)

func main() {
	sc = initScanner(os.Stdin)
	n, m := scanInt(sc), scanInt(sc)

	solve(n, m)
}

func solve(n, m int) {
	ans := make([]int, n)

	for i := 0; i < m; i++ {
		ans[scanInt(sc)-1]++
		ans[scanInt(sc)-1]++
	}

	for _, v := range ans {
		fmt.Println(v)
	}
}

// --------------- BASE DEFINITIONS ---------------

const (
	initialBufSize = 100000
	maxBufSize     = 1000000
)

var sc *bufio.Scanner

func initScanner(r io.Reader) *bufio.Scanner {
	buf := make([]byte, initialBufSize)

	sc := bufio.NewScanner(r)
	sc.Buffer(buf, maxBufSize)
	sc.Split(bufio.ScanWords)
	return sc
}

func scanInt(sc *bufio.Scanner) int {
	sc.Scan()
	i, _ := strconv.Atoi(sc.Text())
	return i
}

func scanIntSlice(sc *bufio.Scanner, n int) []int {
	is := make([]int, n)
	for i := 0; i < n; i++ {
		is[i] = scanInt(sc)
	}

	return is
}

func scanString(sc *bufio.Scanner) string {
	sc.Scan()
	return sc.Text()
}

func scanStringSlice(sc *bufio.Scanner, n int) []string {
	ss := make([]string, n)
	for i := 0; i < n; i++ {
		sc.Scan()
		ss[i] = sc.Text()
	}

	return ss
}
//  [ruby]
n,m = gets.split.map(&:to_i)
ans = Hash.new(0)
m.times do
  a,b = gets.split.map(&:to_i)
  ans[a] += 1
  ans[b] += 1
end

1.upto(n) do |i|
  puts ans[i]
end
//  [ruby]
N,M=gets.split.map(&:to_i)

r=Array.new(N,0)

M.times do
    a,b=gets.split.map(&:to_i)
    r[a-1] += 1
    r[b-1] += 1
end

puts r
//  [ruby]
def get_i() #空白区切の入力を数値(整数)の配列で返す
  return gets.chomp.split(" ").map(&:to_i)
end
def get_f() #空白区切の入力を数値(実数)の配列で返す
  return gets.chomp.split(" ").map(&:to_f)
end
def get() #空白区切の入力を文字列の配列で返す
  return gets.chomp.split(" ")
end
def get_nsp() #入力されたものを一文字ずつに区切った文字列の配列で返す
  return gets.chomp.split("")
end
def yn_judge(bool,y="Yes",n="No") #boolに真偽を投げることで、trueならy、falseならnの値を出力する
  return bool ? y : n 
end
def array(size,n=1,init=nil) #nに配列の次元数、sizeに配列の大きさ、initに初期値を投げることでその配列を返す
  if n==1
    return Array.new(size){init}
  else
    return Array.new(n).map{Array.new(size){init}}
  end
end

n,m=get_i
city=array(n,1,0)
m.times do|i|
  a,b=get_i
  a-=1
  b-=1
  city[a]+=1
  city[b]+=1
end
n.times do|i|
  puts city[i]
end
//  [ruby]
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end
n, m = gets_i_list
alist, blist = [],[]

ans = [0] * (n+1)

m.times do
  a, b = gets_i_list
  ans[a] = ans[a].to_i + 1
  ans[b] = ans[b].to_i + 1
end

1.upto(n+1) do |i|
  puts ans[i]
end
//  [ruby]
N, M = gets.split.map &:to_i
arr = Array.new(N, 0)
M.times do
  a, b = gets.split.map &:to_i
  arr[a-1] += 1
  arr[b-1] += 1
end
arr.each do |e|
  puts e
end
//  [ruby]
require 'pp'
$DEBUG ? define_method(:dpp){|e|pp e} : define_method(:dpp){|e|}

# 空白区切の入力値を数値の配列で返却する
def gets_i_list()
  gets.chomp.split(" ").map(&:to_i)
end
n, m = gets_i_list

ans = [0] * (n+1)

m.times do
  a, b = gets_i_list
  ans[a] += 1
  ans[b] += 1
end

1.upto(n+1) do |i|
  puts ans[i]
end
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::collections::HashMap;
fn main() {
    input!{
        n: u32,
        m: usize,
        ab: [u32; 2*m],
    };
    let mut map = HashMap::new();
    ab.iter().map(|x| *map.entry(x).or_insert(0) += 1).count();
    (1..n+1).map(|x| println!("{}", map.get(&x).unwrap_or(&0))).count();
}
//  [rust]
#![allow(unused, non_snake_case, dead_code, non_upper_case_globals)]
use std::cmp::*;
use std::collections::*;
use std::mem::*;

fn main() {
    let (r, w, e) = (std::io::stdin(), std::io::stdout(), std::io::stderr());
    let mut io = IO::new(r.lock(), w.lock(), e.lock());
    assert_eq!(!0usize, std::usize::MAX); //🙊
    assert!(0 == 0); //😇
    let (n, m) = (io.read::<usize>(), io.read::<usize>());
    let mut cnt = vec![0; 55];
    for _ in 0..m {
        let a = io.read::<usize>();
        let b = io.read::<usize>();
        cnt[a] += 1;
        cnt[b] += 1;
    }
    for i in 1..n + 1 {
        io.writeln(cnt[i]);
    }
}

static MX: usize = 1010101;
static MOD: i64 = 1000000007;
static INF: i64 = std::i64::MAX >> 1;
// IO
use std::io::*;
struct IO<R: Read, W: Write, E: Write> {
    Read: R,
    Write: BufWriter<W>,
    Error: BufWriter<E>,
}
impl<R: Read, W: Write, E: Write> IO<R, W, E> {
    fn new(r: R, w: W, e: E) -> IO<R, W, E> {
        IO {
            Read: r,
            Write: BufWriter::new(w),
            Error: BufWriter::new(e),
        }
    }
    fn read<T>(&mut self) -> T
    where
        T: std::str::FromStr,
    {
        let next: String = self
            .Read
            .by_ref()
            .bytes()
            .map(|c| c.unwrap() as char)
            .skip_while(|c| c.is_whitespace())
            .take_while(|c| !c.is_whitespace())
            .collect();
        next.parse().ok().unwrap()
    }
    fn chars(&mut self) -> Vec<char> {
        self.read::<String>().chars().collect()
    }
    fn chari(&mut self) -> Vec<i64> {
        self.chars()
            .iter()
            .map(|&c| (c as u8 - b'0') as i64)
            .collect::<Vec<i64>>()
    }
    fn readn<T: std::str::FromStr>(&mut self, n: usize) -> Vec<T> {
        (0..n).map(|_| self.read::<T>()).collect::<Vec<_>>()
    }
    fn readmat<T: std::str::FromStr>(&mut self, n: usize, m: usize) -> Vec<Vec<T>> {
        (0..n).map(|_| self.readn(m)).collect()
    }
    fn write<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
    }
    fn writeln<S: ToString>(&mut self, val: S) {
        self.Write.write(val.to_string().as_bytes());
        self.Write.write(b"\n");
    }
    fn debug<S: std::fmt::Debug>(&mut self, val: S) {
        writeln!(self.Error, "(debug) {:?}", &val);
    }
    fn debug2<S: std::fmt::Debug, T: std::fmt::Debug>(&mut self, val1: S, val2: T) {
        writeln!(self.Error, "(debug2) {:?} -> {:?}", val1, val2);
    }
    fn debug3<S: std::fmt::Debug, T: std::fmt::Debug, U: std::fmt::Debug>(
        &mut self,
        val1: S,
        val2: T,
        val3: U,
    ) {
        writeln!(
            self.Error,
            "(debug3) {:?} -> {:?} -> {:?}",
            val1, val2, val3
        );
    }
}
//  [rust]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
    ($($r:tt)*) => {
        let mut s = {
            use std::io::Read;
            let mut s = String::new();
            std::io::stdin().read_to_string(&mut s).unwrap();
            s
        };
        let mut iter = s.split_whitespace();
        input_inner!{iter, $($r)*}
    };
}

macro_rules! input_inner {
    ($iter:expr) => {};
    ($iter:expr, ) => {};

    ($iter:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($iter, $t);
        input_inner!{$iter $($r)*}
    };
}

macro_rules! read_value {
    ($iter:expr, ( $($t:tt),* )) => {
        ( $(read_value!($iter, $t)),* )
    };

    ($iter:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($iter, $t)).collect::<Vec<_>>()
    };

    ($iter:expr, chars) => {
        read_value!($iter, String).chars().collect::<Vec<char>>()
    };

    ($iter:expr, usize1) => {
        read_value!($iter, usize) - 1
    };

    ($iter:expr, $t:ty) => {
        $iter.next().unwrap().parse::<$t>().expect("Parse error")
    };
}

use std::collections::HashMap;
fn main() {
    input!{
        n: u32,
        m: usize,
        ab: [u32; 2*m],
    };
    let mut map = HashMap::new();
    for i in ab {
        *map.entry(i).or_insert(0) += 1;
    }
    for i in 1..n+1 {
        println!("{}", map.get(&i).unwrap_or(&0));
    }
}
//  [rust]
#![allow(unused_macros)]
#![allow(dead_code)]
#![allow(unused_imports)]

use text_io::*;

const U_INF: usize = 1 << 60;
const I_INF: isize = 1 << 60;

fn main() {
    let n: usize = read!();
    let m: usize = read!();
    let mut cities = vec![0; n];
    for _ in 0..m{
        let a: usize = read!();
        let b: usize = read!();
        cities[a-1]+=1;
        cities[b-1]+=1;
    }
    
    for c in cities{
        println!("{}", c);
    }
}
//  [rust]
fn main() {
    proconio::input! {
    a:usize,
    b:usize,
    c:[usize;b*2],
  }
    let mut v = vec![0; a];
    for i in 0..b*2 {
        v[c[i]-1]+=1;
    }
    for i in 0..a {
        println!("{}",v[i])
    }
}
//  [rust]
fn main() {
	proconio::input!{
		n: usize,
		m: usize,
		a: [proconio::marker::Usize1; m*2],
	}

	let mut city: [usize; 50] = [0; 50];
	for i in 0..m*2 {
		city[a[i]] += 1;
	}
	for i in 0..n {
		println!("{}", city[i]);
	}
}
//  [swift]
import Foundation

#if swift(>=4.0)
extension String {
    func split(by separator: String) -> [String] {
        return self.components(separatedBy: separator)
    }
    func toArray() -> [String] {
        return self.map{String($0)}
    }
}
func exponentiate(_ lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#else
extension String {
    func split(by separator: String) -> [String] {
        return self.componentsSeparatedByString(separator)
    }
    var count: Int {
        return self.characters.count
    }
    func toArray() -> [String] {
        return self.characters.map{String($0)}
    }
    func uppercased() -> String {
        return self.uppercaseString
    }
    func lowercased() -> String {
        return self.lowercaseString
    }
}
//extension Array where Element == String {
//    func joined(separator separator: String) -> String {
//        return self.joinWithSeparator(separator)
//    }
//}
extension Array where Element: Comparable {
    func max() -> Element {
        return self.maxElement()!
    }
    func min() -> Element {
        return self.minElement()!
    }
    func sorted() -> Array {
        return self.sort()
    }
    func reversed() -> Array {
        return self.reverse()
    }
    mutating func sort() {
        self.sortInPlace()
    }
}
extension Array {
    init(repeating: Element, count: Int) {
        self.init(count: count, repeatedValue: repeating)
    }
}
func stride<T: Strideable>(from start: T, to end: T, by stride: T.Stride) -> StrideTo<T> {
    return start.stride(to: end, by: stride)
}
func exponentiate(lhs: Int, _ rhs: Int) -> Int {
    return (0..<rhs).reduce(1){i,_ in i*lhs}
}
#endif
func readInt() -> Int? {
    return Int(readLine()!)
}
func readStringSplit(by separator: String) -> [String] {
    return readLine()!.split(by: separator)
}
func readIntSplit(by separator: String) -> [Int] {
    return readLine()!.split(by: separator).map{Int($0)!}
}

/*************** テストスペース ***************/



/*************** メインプログラム ***************/

let input = readIntSplit(by: " ")
let (N, M) = (input[0], input[1])
var road = [Int](repeating: 0, count: N)
for _ in 0..<M {
    let input = readIntSplit(by: " ")
    let (a, b) = (input[0], input[1])
    road[a-1] += 1
    road[b-1] += 1
}
for i in road {
    print(i)
}
//  [swift]
import Foundation
func toTuple<T>(_ args: [T]) -> (T, T) { (args[0], args[1]) }
func readInts() -> [Int] { readLine()!.split(separator: " ").map { Int($0)! } }

let (n, m) = toTuple(readInts())
var ai: [Int] = []
for _ in 0..<m {
  ai.append(contentsOf: readInts())
}
for i in 1...n {
  print(ai.filter { $0 == i }.count)
}
//  [swift]
import Foundation

extension String {
    var argi: [Int] { return self.characters.split(" ").map { Int(String($0))! } }
}

let inp = readLine()!.argi

let n = inp[0]
let m = inp[1]

var res = [Int]()
for _ in 0..<n
{
    res.append(0)
}

for _ in 0..<m {
    let inp = readLine()!.argi
    let a = inp[0] - 1
    let b = inp[1] - 1

    res[a] += 1
    res[b] += 1
}

for i in 0..<n {
    print(res[i])
}
//  [typescript]
const log = console.log;

const createScanFunctions = (input: string) => {
  const str = input.trim();
  const len = str.length;
  let index = 0;

  const scan = () => {
    const startIndex = index;

    while (index < len) {
      const char = str[index];

      if (char === " " || char === "\n")
        return str.substring(startIndex, index++);

      index++;
    }

    return str.substr(startIndex);
  };

  const scanInt = () => parseInt(scan());

  return { scan, scanInt };
};

// ----

function Main(input: string): void {
  const { scanInt } = createScanFunctions(input);
  const [n, m] = [scanInt(), scanInt()];

  const cityRoadCountArray = Array<number>(n + 1).fill(0);

  for (let i = 0; i < m; i++) {
    cityRoadCountArray[scanInt()]++;
    cityRoadCountArray[scanInt()]++;
  }

  for (let i = 1; i <= n; i++) log(cityRoadCountArray[i]);
}

Main(require("fs").readFileSync("/dev/stdin", "utf8"));
//  [typescript]
const input=require('fs').readFileSync('/dev/stdin','utf8').split(/[\s]/);let input_i=-1;const tn=():number=>{input_i++;return Number(input[input_i])};const tnn=(n:number):number[]=>{const a=[];for(let i=0;i<n;i++){a.push(tn())}return a};const ts=():string=>{input_i++;return String(input[input_i])};const tss=(n:number):string[]=>{const a=[];for(let i=0;i<n;i++){a.push(ts())}return a};const to=(...arg)=>{console.log(...arg)};const abs=(a)=>{return Math.abs(a)};const min=(...a)=>{return Math.min(...a)};const max=(...a)=>{return Math.max(...a)};const floor=(a)=>{return Math.floor(a)};const asc=(ar:number[])=>{const t=[...ar];return ar.sort((a,b)=>{return a-b})};const desc=(ar:number[])=>{const t=[...ar];return t.sort((a,b)=>{return b-a})};const sw=(a,arr:any[],op:'=='|'>='|'>'|'<='|'<'='==')=>{for(let i=0;i<arr.length-1;i+=2){if(eval(a+op+arr[i])){return arr[i+1]}}return arr[arr.length-1]};const near=(n:number,arr:number[]):number=>{let ne=arr[0],ni=0;for(let i=1;i<arr.length;i++){if(Math.abs(n-ne)>Math.abs(n-arr[i])){ne=arr[i];ni=i}}return ni};const deduplicate=(a:any[]):any[]=>{return Array.from(new Set(a))}
const main=()=>{
  let [n,m]=tnn(2)
  let citys=new Array(n)
  citys.fill(0)
  for(let i=0;i<m;i++){
    citys[tn()-1]++
    citys[tn()-1]++
  }
  for(let i=0;i<n;i++){
    to(citys[i])
  }
}
main()
//  [typescript]
import { readFileSync } from "fs";

const read = () =>
  readFileSync(0, "utf8")
    .split("\n")
    .map((line) => line.split(" "));

const main = (input: string[][]) => {
  const [N, M] = input[0].map(Number);

  const answer = Array(N).fill(0);

  for (let i = 1; i <= M; i++) {
    const [a, b] = input[i].map(Number);

    answer[a - 1] += 1;
    answer[b - 1] += 1;
  }

  return answer.join("\n");
};

console.log(main(read()));
//  [python]
n,X = map(int,input().split())
l =  list(map(int,input().split()))
l.sort(reverse = True)
ans = 10**10
yakusuu = []
count= 0
if n == 1:
  print(abs(l[0]-X))
  exit()
  
for i in l:
  ans = min(ans,abs(i-X))
  if i-X < 0:
    break

for i in range(1,ans+1):
  if ans%i == 0:
    yakusuu.append(i)

yakusuu.reverse()

for i in yakusuu:
  for j in range(n-1):
    if (l[j]-l[j+1])%i != 0:
      break
    elif (l[j]-l[j+1])%i == 0:
      count += 1
      if count == len(l) - 1:
        print(i)
        exit()
//  [python]
from fractions import gcd
import numpy as np
N, X = map(int, input().split())
xlist = np.array(list(map(int, input().split())))
xabs = np.abs(xlist - X)
num = xabs[0]
for x in xabs:
    num = gcd(x, num)
print(num)
//  [python]
N,X=map(int,input().split())
x=sorted(map(lambda x:abs(int(x)-X),input().split()))
for i in range(x[0]+1)[::-1]:
    if x[0]%i:continue
    if sum(map(lambda x:x%i,x))==0:
        print(i)
        break
//  [java]
import java.util.Scanner;
public class Main{

	public static void main(String[] args) {

		Scanner sc = new Scanner(System.in);

		int N = sc.nextInt();

		int X = sc.nextInt();

		int[] x = new int[N];

		x[0] = sc.nextInt();

		int max = x[0];

		int min = x[0];

		int ansMax = 0;	//答えになりうる値の最大値

		for(int i=1;i<N;i++) {

			x[i] = sc.nextInt();

			if(max < x[i]) {

				max = x[i];

			}

			if(min > x[i]) {

				min = x[i];
			}

		}



		ansMax = Math.min(Math.abs(X-max), Math.abs(X-min));


		boolean flag;

		//System.out.println(ansMax);

		for(int i = ansMax;i>0;i--) {	//D

			flag = true;

			for(int j=0;j<x.length;j++) {

				if(i %2 == 0 && (Math.abs(x[j])-X)%2 != 0) {

					flag = false;

					break;
				}

				if(Math.abs(x[j] - X ) < i ) {

					flag = false;

					break;

				}




				if(Math.abs(x[j] - X) % i != 0) {

					flag = false;

					break;
				}
			}

			if(flag == true) {

				System.out.println(i);

				break;
			}


		}

	}

}
//  [java]
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		
		int N = sc.nextInt();
		long X = sc.nextLong();
		
		if (N == 1) {
			System.out.println(Math.abs(X - sc.nextLong()));
			return;
		}
		
		List<Long> cityList = new ArrayList<>();
		
		cityList.add(X);
		for (int i = 0; i < N; i++) {
			cityList.add(sc.nextLong());
		}
		Collections.sort(cityList, Collections.reverseOrder());

		long lastDiff = Math.abs(cityList.get(0) - cityList.get(1));
		long minNum = Math.abs(cityList.get(cityList.size() - 1));

		for (long k = lastDiff; k >= 1; k--) {
			for (int i = 0; i < N + 1; i++) {
				if (!(Math.abs(cityList.get(i)) % k == minNum % k)) {
					break;
				}
				if (i == N) {
					System.out.println(k);
					return;
				}
			}
		}
	}
}
//  [java]
import java.util.ArrayList;
import java.util.Comparator;
import java.util.Scanner;

public class Main {
    public static void main(String[] args)  {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int x = sc.nextInt();
        ArrayList<Integer> poses = new ArrayList<>();
        poses.add(x);
        for (int i = 0;i < n;++i){
            poses.add(sc.nextInt());
        }
        poses.sort(Comparator.comparingInt(a -> a));
        int m = poses.get(1) - poses.get(0);
        for (int i = 1;i < n;++i){
            int p = poses.get(i + 1) - poses.get(i);
            while (m != p){
                if(m > p)m = m - p;
                else p = p - m;
            }
            if(m == 1){
                System.out.println(1);
                return;
            }
        }
        System.out.println(m);
    }

}
//  [cpp]
#include <iostream>
#include <stdlib.h>
using namespace std;

int gcd(int a, int b) {
	if (a%b == 0)
		return b;
	if (b%a == 0)
		return a;
	int i;
	if (a < b)
		i = a;
	else
		i = b;
	for (; i > 1; i--) {
		if (a%i == 0 && b%i == 0)
			break;
	}
	return i;
}

int main() {
	int n, X, d; cin >> n >> X;
	int *x = new int[n];
	cin >> x[0];
	d = abs(X - x[0]);
	for (int i = 1; i < n; i++) {
		cin >> x[i];
		d = gcd(d, abs(X - x[i]));
	}
	cout << d << endl;
	return 0;
}
//  [cpp]
#include <iostream>
#include <stdlib.h>
using namespace std;

int gcd(int a, int b) {
	if (a%b == 0)
		return b;
	if (b%a == 0)
		return a;
	int i, n, m;
	if (a < b) {
		n = b;
		m = a;
		i = a;
	}
	else {
		n = a;
		m = b;
		i = b;
	}
	for (; i > 1; i--) {
		if (n%i == 0 && m%i == 0)
			break;
	}
	return i;
}

int main() {
	int n, X, d; cin >> n >> X;
	int *x = new int[n];
	cin >> x[0];
	d = abs(X - x[0]);
	for (int i = 1; i < n; i++) {
		cin >> x[i];
		d = gcd(d, abs(X - x[i]));
	}
	cout << d << endl;
	return 0;
}
//  [cpp]
#include<bits/stdc++.h>
using namespace std;

int i,j,k,m,n;
int a[100010];

int gcd(int a,int b){
	int t=min(a,b);
	while(t){
		if(a%t==0 && b%t==0)
			break;
		t--;
	}
	return t;
}

int main() {
	scanf("%d%d",&n,&m);
	for(i=1;i<=n;i++){
		int t;
		scanf("%d",&t);
		a[i]=abs(t-m);
	}
	if(n==1){
		printf("%d",a[1]);
		return 0;
	}
	int ans=gcd(a[1],a[2]);
	for(i=3;i<=n;i++)
		ans=gcd(ans,a[i]);
	printf("%d",ans);
	return 0;
}
//  [c]
//c.c C-Skip
#include<stdio.h>
#include<stdlib.h>
typedef long long lld;

lld gcd(lld a,lld b){
    if(a==b){
        return a;
    }else if(a>b){
        return gcd(a-b,b);
    }else{
        return gcd(a,b-a);
    }
}

int cmp(const void *a,const void *b){
    if(*(lld*)a<*(lld*)b){
        return -1;
    }else{
        return 1;
    }
    return 0;
}

lld iabs(lld a){
    if(a>0){
        return a;
    }
    return -a;
}


int main(void){
    lld n,x;
    scanf("%lld %lld",&n,&x);
    lld ix[n+1];
    for(int i=0;i<n;++i){
        scanf("%lld",&ix[i]);
    }
    ix[n] = x;

    if(n==1){
        printf("%lld\n",iabs(ix[0]-ix[1]));
        return 0;
    }
    qsort(ix,n+1,sizeof(lld),cmp);

    lld iy[n];
    for(int i=0;i<n;++i){
        iy[i] = ix[i+1] - ix[i];
    }

    lld gg = gcd(iy[0],iy[1]);

    for(int i=2;i<n;++i){
        gg = gcd(gg,iy[i]);
    }
    printf("%lld\n",gg);
    return 0;
}
//  [c]
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <ctype.h>
#include <stdint.h>
#include <string.h>
#include <wchar.h>

#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define ABS(a) ((a) < 0 ? -(a) : (a))
#define ABSS(a, b) ((a) > (b) ? (a) - (b) : (b) - (a))

int compare_f(const void *a, const void *b) {
	return *((size_t *)a) < *((size_t *)b) ? -1 : 1;
}

static size_t comb(const size_t n, const size_t r) {
	size_t result = 1;

	for (size_t i = 0; i < r; i++) {
		result *= n - i;
		result /= i + 1;
	}

	return result;
}

static size_t x[100000];

int main(void) {
	size_t N, X;

	scanf("%zu %zu\n", &N, &X);
	for (size_t idx = 0; idx < N; idx++) {
		scanf("%zu", &x[idx]);
		if (idx < N - 1) {
			scanf(" ");
		}
	}
	
	qsort(x, N, sizeof(size_t), compare_f);

	size_t minAbss = (size_t)UINT32_MAX;

	if (X < x[0]) {
		const size_t rightAbssX = x[0] - X;
		if (rightAbssX < minAbss) {
			minAbss = rightAbssX;
		}
	}
	else if (x[N - 1] < X) {
		const size_t leftAbssX = X - x[N - 1];
		if (leftAbssX < minAbss) {
			minAbss = leftAbssX;
		}
	}

	for (size_t idx = 0; idx < N - 1; idx++) {
		const size_t abss = x[idx + 1] - x[idx];
		if (abss < minAbss) {
			minAbss = abss;
		}
		if (x[idx] < X && X < x[idx + 1]) {
			const size_t leftAbssX = X - x[idx];
			if (leftAbssX < minAbss) {
				minAbss = leftAbssX;
			}
			const size_t rightAbssX = x[idx + 1] - X;
			if (rightAbssX < minAbss) {
				minAbss = rightAbssX;
			}
		}
	}

	size_t dCandidate = minAbss;
	while (1 < dCandidate) {
		bool isCommonDivisor = true;
		for (size_t idx = 0; idx < N; idx++) {
			const size_t abss = ABSS(X, x[idx]);
			if (abss%dCandidate != 0) {
				isCommonDivisor = false;
			}
		}
		if (isCommonDivisor) {
			break;
		}
		dCandidate--;
	}

	printf("%zu\n", dCandidate);

	return 0;
}
//  [c]
#include<stdio.h>
long buffer[100000000];
void merge(long a[],long left,long right){
    if(left<right){
        long axis=(left+right)/2,i=left,p=0,q=left,r=0;
        merge(a,left,axis);
        merge(a,axis+1,right);
        while(i<=axis)buffer[p++]=a[i++];
        while(i<=right && r<p)a[q++]=(a[i]<=buffer[r])?a[i++]:buffer[r++];
        while(r<p)a[q++]=buffer[r++];
    }
}
int main(void){
    long N,X;
    scanf("%ld%ld",&N,&X);
    long Xi[N];
    for(int i=0;i<N;i++){
        scanf("%ld",&Xi[i]);
    }
    for(int i=0;i<N;i++){
        Xi[i]=Xi[i]-X;
        if(Xi[i]<0){
            Xi[i]=-1*Xi[i];
        }
    }
    merge(Xi,0,N-1);
    long D=Xi[0];
    long c=0;
    long a=0;
    while(c!=1){
        for(int i=0;i<N;i++){
            a=0;
            if((Xi[i]%D)!=0){
                a=1;
                D-=1;
                break;
            }
        }
        if(a==0){c=1;}
    }
    printf("%ld\n",D);
}
//  [javascript]
'use strict';

const main = (input) => {
    const t = input.split('\n');
    const nx = t[0].split(' ');
    const xs = t[1].split(' ');
    const N = parseInt(nx[0], 10);
    const X = parseInt(nx[1], 10);

    // f(a) = (X - x(a)), 全てのxでf(a)がDの倍数となるような最大のDを求める、
    // 簡単のため X = 0 に座標系をずらす、最大公約数を求める問題となった
    const xk = {};
    let m = Math.pow(10, 10); // 最小値
    xs.forEach(v => {
        v = Math.abs(parseInt(v, 10) - X);
        if (v != 0) {
            xk[v] = true;
        }
        if (v < m) {
            m = v;
        }
    });
    const x = Object.keys(xk);
    // 最小公倍数は必ず最小値より小さい。
    let d = m;
    while (d != 1) {
        let r = x.every(v => {
            return (v % d) == 0;
        });
        if (r) {
            break;            
        }
        // 見つからなかった... m == d の時だけ 次は d/2 に飛ばす
        if (m == d) {
            d = Math.floor(d / 2);
        } else {
            d--;
        }
    }
    console.log(d);
};

const isTest = false;

if (isTest) {
    main('3 3\n1 7 11');
    main('3 81\n33 105 57')
    main('1 1\n1000000000')
} else {
    main(require('fs').readFileSync('/dev/stdin', 'utf8'));
}